java - Syntax error on system.out.println? -
this constants type double.
i getting syntax error 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 constants outside of main
method:
public final class netpay { 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; public static void main(string[] args) { // rest of code goes here } }
and mentioned, make system have uppercase s: system.out.println
.
Comments
Post a Comment