<identifier> expected error
I am trying to finish up and submit a project for class that will take the persons name hours worked and rate and return the gross pay. I realise that its probably not right, and the fun si figuring out how to fix it. I managed to crrect everything except an error in the ButtonListerner can anyone help. Not to rush this but it has to be e-mailed in in the next 4-5 hours.
my code is as follows:
//program by Luke Walsh
import javax.swing.*;// JButton and JTextField
import java.awt.*;// Container and GridLayout
import java.awt.event.*;// ActionListener and ActionEvent
publicclass ABCPlumbingextends JFrame
{
privatedouble rate, hour, gross, A, B;
private String nam, time, pay;
private JTextField names, times, pays;
private JLabel nombre, hours, payment, grossAMT;
private JButton math;
publicstaticvoid main( String[] args )
{
ABCPlumbing window =new ABCPlumbing();
window.Initialize();
window.show( );
}
public ABCPlumbing()
{
rate = 0;
hour = 0;
gross = 0;
}
publicvoid Initialize()
{
setTitle("ABC Plumbing" );
setSize( 400, 200 );
setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
Container con = getContentPane();
con.setLayout(new GridLayout( 5, 2 ) );
names =new JTextField();
nombre =new JLabel("Enter employee's name:" );
times =new JTextField();
hours =new JLabel("Enter rate of pay/hr:" );
pays =new JTextField();
payment =new JLabel("Enter the # of hours worked:" );
grossAMT =new JLabel(" Gross pay: ? " );
math =new JButton("Click her once all data is entered");
con.add( nombre );
con.add( names );
con.add( hours );
con.add( times );
con.add( payment );
con.add( pays );
con.add( grossAMT );
con.add( math );
TextFieldListener nameListener =new TextFieldListener();
names.addActionListener ( nameListener );
TextFieldListener timeListener =new TextFieldListener();
times.addActionListener ( timeListener );
TextFieldListener paysListener =new TextFieldListener();
pays.addActionListener ( paysListener );
}
ButtonListener mathButton =new ButtonListener();
math.addActionListener( mathButton );
**********INNER CLASS**********
privateclass TextFieldListenerimplements ActionListener
{
publicvoid actionPerformed( ActionEvent event )
{
A = Integer.parseInt( times.getText() );
B = Integer.parseInt( pays.getText() );
if( A < 40 )
{
gross = B * A;
}
else
gross = (( B * 1.5 ) * A);
grossAMT.setText("Gross Pay: " + gross );
}
}
}
The error text is :
--Configuration: <Default>--
C:\myJava\ABC Plumbing\ABCPlumbing.java:77: <identifier> expected
math.addActionListener ( mathButton );
^
1 error
Process completed.

