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

public class data4
{
     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];
	
try
{
WritableWorkbook workbook = Workbook.createWorkbook(new File("DATA4.xls")); 
WritableSheet sheet = workbook.createSheet("First Sheet", 0); 
NumberFormat fivedps = new NumberFormat("##.#####"); 
WritableCellFormat fivedpsFormat = new WritableCellFormat(fivedps); 
for(int i=0;i<21;i++)
{
jxl.write.Number nx = new jxl.write.Number(1, i+1, i, fivedpsFormat); 
sheet.addCell(nx); 
jxl.write.Number ny = new jxl.write.Number(2, i+1, Math.sin(i*Math.PI/20), fivedpsFormat); 
sheet.addCell(ny); 
}
workbook.write();
workbook.close();  
}catch(jxl.write.WriteException we) {System.out.println("write exception");}
}

}