import static java.lang.Math.*;
import java.io.*;
import java.util.*;
import javax.swing.*;
import javax.swing.table.*;
import java.awt.*;

//============= Function to be define ================

class fa3 extends f_x
{  double a;
	public fba(double a1)
   { a=a1;}
   
   public double func(double x)
   { return x*x*x-a;}
}
class fa2 extends f_x
{  double a;
	public fba(double a1)
   { a=a1;}
   
   public double func(double x)
   { return x*x-a;}
}
//===========================================================
public class WK1HW1A
{
public static double cubicroot(double a)
{double x1=a;
 fa3 f=new fba(a);
 return secant(f,x1);
}
public static double sqrt(double a)
{double x1=a;
 fa2 f=new fba(a);
 return secant(f,x1);
}
public static double secant(f_x f,double x)
{
int nmax=100;
double tolerance=1.0e-102;
double fx,dfx;
double dx=0.01;
for(int i=0;i<nmax;i++)
{
  fx=f.func(x);
  dfx=f.dfunc(x);
  x-=fx/dfx;
  if(Math.abs(fx)<tolerance) { return x;}
}
JOptionPane.showMessageDialog(null,"Warning : Maximum number of iteration is exceeded \n"+
   " çözüm geçerli olmıyabilir","MAXİMUM ITERATION NUMBER WARNING",JOptionPane.WARNING_MESSAGE);
return x;
}

     public static void main (String args[]) throws IOException  
     { 
     double a,b;
     a=Double.parseDouble(JOptionPane.showInputDialog(" input your number a "));
     double r;
     r= cubicroot(a);
     JOptionPane.showMessageDialog(null," cubic root : "+r+"\n",
     "cubic root of a number : ",JOptionPane.PLAIN_MESSAGE);
     System.exit(0);
     } 
}