How can I fix this java program please: System.out.print(\"Enter the hours worke
ID: 3663338 • Letter: H
Question
How can I fix this java program please:
System.out.print("Enter the hours worked by employee this week: "); // prompt
hoursWorked = input.nextDouble(); // read hours worked
} // end while
if (hoursWorked > 40)// Overtime
{
grossPay = hoursWorked * hourlyRate;//multiplication
overTime = (hoursWorked-40) * (hourlyRate*20.5);
taxDeduction = grossPay * .15;
System.out.printf("federal taxes: $%.2f ", taxDeduction);
System.out.println();
netPay = grossPay - taxDeduction;
System.out.printf("net pay: $%.2f ", netPay);
System.out.println();
netPay = hoursWorked * hourlyRate;
System.out.println("Employee:" + getName);
System.out.printf("Hourly Rate: $%.2f ", hourlyRate);
System.out.println("Regular Hours worked:" + hoursWorked);
System.out.printf("Gross Pay: $%.2f ", netPay);
}
System.out.printf( "Enter employee name or 'quit' to exit:");
getName = input.next();
Explanation / Answer
System.out.print("Enter the hours worked by employee this week: "); // prompt
hoursWorked = input.nextDouble(); // read hours worked
if (hoursWorked > 40)// Overtime
{
grossPay = hoursWorked * hourlyRate;//multiplication
overTime = (hoursWorked-40) * (hourlyRate*20.5);
taxDeduction = grossPay * .15;
System.out.printf("federal taxes: $%.2f ", taxDeduction);
System.out.println();
netPay = grossPay - taxDeduction;
System.out.printf("net pay: $%.2f ", netPay);
System.out.println();
netPay = hoursWorked * hourlyRate;
System.out.println("Employee:" + getName);
System.out.printf("Hourly Rate: $%.2f ", hourlyRate);
System.out.println("Regular Hours worked:" + hoursWorked);
System.out.printf("Gross Pay: $%.2f ", netPay);
}
System.out.printf( "Enter employee name or 'quit' to exit:");
getName = input.next();
} // end while
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.