public class W13EX1
{ public static String createfunction(String name,String function) 
 {
 String s="";
 String name1=name+".java";
 try {PrintWriter ffout=new PrintWriter(new BufferedWriter(new FileWriter(name1))); 
 s+="class "+name+" extends f_x\n";
 s+=" {\n";
 s+=" public double func (double x)\n";
 s+="{ double y="+function+";\n";
 s+=" return y;\n";
 s+="}\n";
 s+="}\n";
 ffout.println(s);
 ffout.close();
 }
 catch(IOException e1) {System.err.println("girdi hatası.");} 
 catch(NumberFormatException e2){}; 
 return s;
 }

     // main method begins execution of Java application
     public welcome()
     {
        System.out.println(createfunction("f2D","sin(x)"));  );
     }
}
