"indentifier expected" error

Hi,
I'm writing a simple program which involves using a set method to pass a number of values from one class to another but I'm repeatedly getting the error: expected.

The class I'm trying to pass the values to is as follows:


public PaySlip(Employee e)
{
gross = 0;
tax = 0;
taxCredits = 0;
emp = e;
}

public void setGross(double grossPay)
{
gross = grossPay;
}

public void setTax(double grossMonthTax)
{
tax = grossMonthTax;
}

public void setTaxCreds(double netTax)
{
taxCredits = netTax;
}

and the class I'm taking the values from is as follows:

public void calcPay(PaySlip p)
{
double grossMonthPay = 0;
double grossMonthTax = 0;
double netTax = 0;

grossMonthPay = 3000;
if (taxcode == 1)
{
grossMonthTax = grossMonthPay*0.2;
}

else if (taxcode == 2)
{
grossMonthTax = grossMonthPay*0.42;
}

else
grossMonthTax = 0;
}

p.setGross(grossMonthPay);
p.setTax(grossMonthTax);

netTax = grossMonthTax - taxCredits;
ytdGross = ytdGross + grossMonthTax;
ytdTax = ytdTax + netTax;
}


as I said I keep getting an error around the
p.setGross(grossMonthPay);
and below lines.

Any help would be greatly appreciated!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories