import java.io.*;
import javax.swing.*;
import jxl.*; 
import jxl.write.*;
import jxl.format.*;
 
//import java.util.Locale;

public class data5
{
     public static String toString(double x[],double y[]) 
     {   
	 String s="";
     for(int i=0;i<x.length;i++)
     {s+="x["+i+"][ "+x[i]+"y["+i+"] = "+y[i]+"\n ";}

     return s;
     }
	 	
public static void main(String args[]) throws IOException
{
double x[]=new double[21];
double y[]=new double[21];
jxl.write.WritableImage image;	
File ff=new File("fall.png");

try
{
WritableWorkbook workbook = Workbook.createWorkbook(new File("DATA5.xls")); 
WritableSheet sheet = workbook.createSheet("First Sheet", 0); 
NumberFormat fivedps = new NumberFormat("##.#####"); 
WritableCellFormat fivedpsFormat = new WritableCellFormat(fivedps);
image=new jxl.write.WritableImage(0,0,2,5,ff); 
//WritableCellFormat wcf1=new WritableCellFormat();
//wcf1.setBorder(jxl.format.Border.RIGHT,jxl.format.BorderLineStyle.THICK);
WritableCellFormat wcf1=new WritableCellFormat();
wcf1.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN);
jxl.write.Label x_label = new Label(0, 6, "x");
x_label.setCellFormat(wcf1); 
sheet.addCell(x_label); 
jxl.write.Label y_label = new Label(1, 6, "y"); 
y_label.setCellFormat(wcf1); 
sheet.addCell(y_label);

for(int i=0;i<21;i++)
{
jxl.write.Number nx = new jxl.write.Number(0, i+7, i, fivedpsFormat); 
nx.setCellFormat(wcf1);
sheet.addCell(nx); 
 
sheet.addImage(image);
jxl.write.Number ny = new jxl.write.Number(1, i+7, Math.sin(i*Math.PI/20), fivedpsFormat); 
ny.setCellFormat(wcf1);
sheet.addCell(ny); 
}
workbook.write();
workbook.close();  
}catch(jxl.write.WriteException we) {System.out.println("write exception");}
}

}