can some tell me where is the duplicate class in this program .and how to correct it
this program is telling me that there are duplicate classes and I am not seeing any
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | package calculator; import javax.swing.*; import java.awt.event.*; public class Calculator extends JFrame implements ActionListener{ JTextField CoA, CoB, CoC; JLabel Root1, Root2; JLabel CoAx, CoBx, CoCx, Root1x, Root2x; JButton calculateB, exitB; CalButton cbHandler; ExitButton exitButton; public Calculator() { setTitle( "Quadratic Calculator" ); CoAx = new JLabel( "a" , SwingConstants.CENTER); CoBx = new JLabel( "b" , SwingConstants.CENTER); CoCx = new JLabel( "c" , SwingConstants.CENTER); Root1x = new JLabel( "Root1" , SwingConstants.CENTER); Root2x = new JLabel( "Root2" , SwingConstants.CENTER); CoA = new JTextField( 10 ); CoB = new JTextField( 10 ); CoC = new JTextField( 10 ); Root1 = new JLabel( "" , SwingConstants.RIGHT); Root2 = new JLabel( "" , SwingConstants.RIGHT); calculateB = new JButton( "Calculate" ); cbHandler = new CalculateButtonHandler(); calculateB.addActionListener(cbHandler); //Create Exit Button exitB = new JButton( "Exit" ); ebHandler = new ExitButton(); exitB.addActionListener(ebHandler); Container pane = getContentPane(); pane.setLayout( new GridLayout( 6 , 2 )); pane.add(CoAx); pane.add(CoA); pane.add(CoBx); pane.add(CoB); pane.add(CoCx); pane.add(CoC); pane.add(Root1x); pane.add(Root1); pane.add(Root2x); pane.add(Root2); pane.add(calculateB); pane.add(exitB); setSize( 400 , 300 ); setVisible( true ); setDefaultCloseOperation(EXIT_ON_CLOSE); } private class CalButton implements ActionListener { @Override public void actionPerformed(ActionEvent e) { double a = Double.parseDouble(CoA.getText()); double b = Double.parseDouble(CoB.getText()); double c = Double.parseDouble(CoC.getText()); double det = ( 4 * a * c); b = b * b; double R1 = Math.sqrt(b + det); double R2 = Math.sqrt(b - det); Root1.setText( "" + R1); Root2.setText( "" + R2); } } private class ExitsButton implements ActionListener{ @Override public void actionPerformed(ActionEvent e) { System.exit( 0 ); } } public static void main ( String[] args) { Calculator cal = new Calculator(); } } |