please help
I'm trying to make a quadratic solver with a GUI interface, does anybody have this or can anybody tell me what I need to fix with what I've done.
C:\Documents and Settings\Administrator\My Documents\Quadratic12.java:9: Quadratic12 is not abstract and does not override abstract method actionPerformed(java.awt.event.ActionEvent) in java.awt.event.ActionListener
public class Quadratic12 extends JFrame
^
1 error
Tool completed with exit code 1
import java.io.*;
import java.util.StringTokenizer;
import javax.swing.*;
import java.util.*;
import java.awt.event.*;
import java.awt.*;
import java.awt.event.ActionEvent.*;
public class Quadratic12 extends JFrame
implements ActionListener {
public JTextField jtfNumA, jtfNumB, jtfNumC, jtfResult1, jtfResult2;
public JButton jbtSolve, jbtClose, jbtClear;
public double a;
public double b;
public double c;
public double[] roots;
public static void main(String [] args){
Quadratic12 quad = new Quadratic12();
quad.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
quad.setSize(600,130);
quad.setTitle("Quadratic Solution Program");
quad.setVisible(true);
}
public Quadratic12(double a, double b, double c){
this.a=a;
this.b=b;
this.c=c;
}
public Quadratic12() {
JPanel p1 = new JPanel();
p1.setLayout( new FlowLayout());
p1.add(new JLabel("Quadratic Equation : "));
p1.add(jtfNumA = new JTextField(10));
p1.add(new JLabel(" X^2 + "));
p1.add(jtfNumB = new JTextField(10));
p1.add(new JLabel(" X + "));
p1.add(jtfNumC = new JTextField(10));
JPanel p2 = new JPanel();
p2.setLayout( new FlowLayout());
p2.add(new JLabel("X = : "));
p2.add(jtfResult1 = new JTextField(10));
p2.add(new JLabel("or"));
p2.add(jtfResult2 = new JTextField(10));
jtfResult1.setEditable(false);
jtfResult2.setEditable(false);
JPanel p3 = new JPanel();
p3.setLayout(new FlowLayout());
p3.add(jbtSolve = new JButton("Solve Quadratic for X"));
p3.add(jbtClose = new JButton("Exit Program"));
p3.add(jbtClear = new JButton("Clear"));
getContentPane().setLayout( new BorderLayout());
getContentPane().add(p1, BorderLayout.NORTH);
getContentPane().add(p2, BorderLayout.CENTER);
getContentPane().add(p3, BorderLayout.SOUTH);
jbtSolve.addActionListener(this);
jbtClose.addActionListener(this);
jbtClear.addActionListener(this);
}
public double[] solve(){
if (a==0&&b==0&&c==0)
roots=null;
else if (a==0&&b==0)
roots=new double[0];
else if (a==0)
roots=new double[]{-c/b};
else{
double d= b*b-4*a*c;
if (d<0)
roots=new double[0];
else if (d==0)
roots=new double[]{ (-b + Math.sqrt(d))/(2*a)};
else
roots=new double[]{
(-b + Math.sqrt(d))/(2*a),
(-b - Math.sqrt(d))/(2*a)
};
}
return roots;
}
{
try{
BufferedReader reader=new BufferedReader(new
InputStreamReader(System.in));
while(true){
System.out.println("1. Calculate quadratic");
System.out.println("2. End");
System.out.print("Input option: ");
String line=reader.readLine();
int option;
try{
option=Integer.parseInt(line);
}
catch(NumberFormatException e){
System.out.println("Invalid entry. Try again");
continue;
}
if (option==2) System.exit(0);
if (option!=1){
System.out.println("Invalid option. Try once more");
continue;
}
System.out.println("Input a, b, and c separated by spaces");
line=reader.readLine();
StringTokenizer tokenizer=new StringTokenizer(line);
if (tokenizer.countTokens()!=3){
System.out.println("Invalid coefficients: expected 3 coefficients");
continue;
}
int a,b,c;
try{
a=Integer.parseInt(tokenizer.nextToken());
b=Integer.parseInt(tokenizer.nextToken());
c=Integer.parseInt(tokenizer.nextToken());
}
catch(NumberFormatException e){
System.out.println("coeffecients must be integers");
continue;
}
Quadratic quadratic=new Quadratic(a,b,c);
System.out.println("Solving the equation: "+a+"*x^2 + "+b+"*x +"+c+" = 0");
double[]roots=quadratic.solve();
if (roots==null)
System.out.println("All x are solutions");
else if (roots.length==0)
System.out.println("No solutions");
else if (roots.length==1)
System.out.println("Solution is: x= "+roots[0]);
else if (roots.length==2)
System.out.println("Solutions are: X= "+roots[0]+" or X="+roots[1]);
}
}
catch(Exception e){
System.out.println("Unexpected error: "+e);
System.exit(1);
}
}
}

