请各位大神帮忙看看哪里出错了,表示新手有点笨哈~
import javax.swing.JOptionPane;public class informations{
public static void main(String[] args){
String nameofEmployeeString=JOptionPane.showInputDialog(
"Enter employee's name:");
String hoursWorkedString=JOptionPane.showInputDialog(
"Enter number of hours worked in a week:");
double hoursWorked=Double.parseDouble(hoursWorkedString);
String hourlyPayRateString=JOptionPane.showInputDialog(
"Enter hourly pay rate:");
double hourlyPayRate=Double.parseDouble(hourlyPayRateString);
String federalTaxWithholdingRateString=JOptionPane.showInputDialog(
"Enter federal tax withholding rate:");
double federalTaxWithholdingRate=Double.parseDouble(federalTaxWithholdingRateString);
String stateTaxWithholdingRateString=JOptionPane.showInputDialog(
"Enter state tax withholding rate:");
double stateTaxWithholdingRate=Double.parseDouble(stateTaxWithholdingRateString);
double grossPay=hourlyPayRate*hoursWorked;
double federalWithholding=grossPay*federalTaxWithholdingRate;
double stateWithholding=grossPay*stateTaxWithholdingRate;
double totalDeduction=federalWithholding+stateWithholding;
double netPay=grossPay - totalDeduction;
String output="Employee's Name:" + nameofEmployee+"\n"+
"Hours Worked:"+hoursWorked+"\n"+
"Pay Rate:$"+hourlyPayRate+"\n"+
"Gross Pay:$"+grossPay+"\n"+
"Deductions:\n"+
"\t Federal Withholding(" + federalTaxWithholdingRate+"%):$"+federalWithholding+"\n"+
"\t State Withholding(" + stateTaxWithholdingRate+"%):$"+stateWithholding+"\n"+
"\t Total Deduction:$"+totalDeduction+"\n"+
"Net Pay:$" + netPay;
JOptionPane.showMessageDialog(null,output);
}
}