Everything is correct, no errors! I dont know How to implement the (20.0%) and the (9.0%) in the Deductions area.[/b] Thanks in advance.
Write a program that reads the following information and prints a payroll statement:
Employee's name
Number of hours worked in a week
Hourly pay rate
Federal tax withholding rate
State tax withholding rate
Enter employee's name: Smith
Enter hours: 10
Enter hourly pay rate: 6.75 <-----Obtain input
Enter federal tax withholding rate: 0.20
Enter state tax withholding rate: 0.09
Employee name: Smith
Hours Worked: 10.0
Pay Rate: $6.75
Gross Pay: $67.5
Deductions:
Federal Withholding (20.0%): $13.5 <----Display output
State Withholding (9.0%): $6.07
Total Deduction: $19.57
Net Pay: $47.92
import java.util.Scanner;
public class Payrolls
{
public static void main(String []args)
{
Scanner input = new Scanner(System.in);
System.out.print("Enter employee name: ");
String employeeName = input.next();
System.out.print("Enter number of hours worked in a week: ");
int hoursWorked = input.nextInt();
System.out.print("Enter hourly pay rate: ");
double payRate = input.nextDouble();
System.out.print("Enter federal tax withholding rate: ");
double fedTax = input.nextDouble();
System.out.print("Enter state tax withholding rate: ");
double stateTax = input.nextDouble();
System.out.print("Employee Name: ");
String EmpName = input.next();
System.out.println("Hours Worked:" + hoursWorked);
System.out.println("Pay Rate:" + payRate);
double grossPay;
grossPay = payRate * hoursWorked;
System.out.println("Gross Pay:" + grossPay);
double deductions;
deductions = grossPay * fedTax;
System.out.println("\tDeductions:");
System.out.println("\t\tFederal Witholding %: $" + deductions);
double statTax;
statTax = grossPay * stateTax;
System.out.println("\t\tState Witholding %: $" + statTax);
double totalDeduction;
totalDeduction = deductions + statTax;
System.out.println("\t\tTotal Deduction: $" + totalDeduction);
double netPay;
netPay = grossPay - totalDeduction;
System.out.println("Net Pay:" + netPay);
}
}
can any 1 fix it and post it here thank you very very much