我正在使用 java 并不断收到错误:预期的类接口或枚举。这是程序,编译器说问题出在最后一行,但我无法弄清楚。
public class Ch3_PrExercise6
{
static Scanner console = new Scanner (System.in);
public static void main(String [] args)
throws Exception
{
final double FEDERAL_TAX_RATE = 0.15;
final double STATE_TAX_RATE = 0.035;
final double SOCIAL_SECURITY_TAX_RATE = 0.575;
final double MEDICARE_MEDICAID_TAX_RATE = 0.0275;
final double PENSION_PLAN = 0.05;
final double HEALTH_INSURANCE = $75;
String name;
double GrossAmount;
double FederalTax;
double StateTax;
double SocialSecurityTax;
double MedicareMedicaidTAx;
double PensionPlan;
double HealthInsurance;
double NetPay;
system.out.print("Bill Robinson");
name = console.nextline();
system.out.println();
system.out.println(name);
grossAmount = console.nextDouble();
federalTAx = grossAmount * FEDERAL_TAX_RATE;
stateTax= grossAmount * STATE_TAX_RATE;
SocialSecurityTax = grossAmount * SOCIAL_SECURITY_TAX_RATE;
MedicareMedicaidTax = grossAmount * MEDICARE_MEDICAID_TAX_RATE;
PensionPlan = grossAmount * PENSION_PLAN_RATE;
HealthInsurance = $75;
NetPay= grossAmount - federalTax - stateTax - SocialSecurityTax - MedicareMedicaidTax - PensionPlan - HealthInsurance;
PrintWriter outfile = new Printwriter("Ch3_Ex6out.txt");
outFile.printf ("Bill Robinson");
outFile.printf ("%n grossAmounT: $%8.2F");
outFile.printf ("%n federalTax $%8.2F");
outFile.printf ("%n stateTax $%8.2F");
outFile.printf ("%n SocialSecurityTax $%8.2F");
outFile.printf ("%n MedicareMedicaidTax $%8.2F");
outFile.printf ("%n Pension Plan $%8.2F");
outFile.printf ("%n HealthInsurance $%8.2F");
outFile.printf ("%n NetPay $%8.2F");
outFile.close();
}
}
}