import javax.swing.*;

class fb implements f_x
{ public double func(double x)
   { return x*x-5.0;}}
   
class fc implements f_x
{ public double func(double x)
   { return x*x*3-5.0*x+2;}}
      

public class H10Ex3c {

public static void main(String args[])
{  
    double x=1.0;
	String s="x ="+x+"\n derivative df/dx [x*x-5.0] = "+numerical.derivative(new fb(),x)+"\n";
	x=2;
	s+="x ="+x+"\n derivative df/dx [x*x-5.0] = "+numerical.derivative(new fb(),x)+"\n";
	x=1;
	s+="x ="+x+"\n derivative df/dx [x*x*3-5.0x+2] = "+numerical.derivative(new fc(),x)+"\n";
	x=2;
    s+="x ="+x+"\n derivative df/dx [x*x*3-5.0x+2] = "+numerical.derivative(new fc(),x)+"\n";
   
   String s1=" indirect referencing and abstract class example :";
   JOptionPane.showMessageDialog(null,s,s1,JOptionPane.PLAIN_MESSAGE);
}
}
