This is for constants type double.
I am getting this syntax error for my system.out.println code:
Syntax error on token ";", @ expected
Thanks!
public final class Netpay {
public static void main(String[] args) {
// TODO Auto-generated method stub
public static final double FEDERAL_TAX_PERCENT = 10.00;
public static final double STATE_TAX_PERCENT = 4.5;
public static final double SS_PERCENT = 6.2;
public static final double MEDICARE_PERCENT = 1.45;
public static final double PAY_PER_HOUR = 7.25;
int hoursPerWeek = 40;
double grossPay = hoursPerWeek * PAY_PER_HOUR;
double federalTax = grossPay * FEDERAL_TAX_PERCENT / 100;
double stateTax = grossPay * STATE_TAX_PERCENT / 100;
double medicare = grossPay * MEDICARE_PERCENT / 100;
double socialSecurity = grossPay * SS_PERCENT / 100;
double netPay = grossPay - (federalTax + stateTax + medicare + socialSecurity);
system.out.println("Hours Per Week = 40");
system.out.println("Gross Pay= grossPay");
system.out.println("Net Pay = netPay");
system.out.println("Deductions:");
system.out.println("Federal= federalTax");
system.out.println("State = stateTax");
system.out.println("Social Security = socialSecurity");
system.out.println("Medicare = medicare");
}
Move your constants outside of the
main
method:And as already mentioned, make system have an uppercase S:
System.out.println
.