I am having some difficulty, any advice would be gladly appreciated. 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 Payroll
{
public static void main (String []args)
{
String name;
int hours;
double rate;
double fedTax;
double stateTax;
Scanner input = new Scanner(System.in);
System.out.print("Enter employee name: ");
System.out.print("Enter number of hours worked in a week: ");
System.out.print("Enter hourly pay rate: ");
System.out.print("Enter federal tax withholding rate: ");
System.out.print("Enter state tax withholding rate: ");
System.out.println("Employee Name: " + string)
double grossPay;
grossPay = rate * hours;
double fedwithHolding;
fedwithHolding = fedTax * grossPay;
double statewithHolding;
statewithHolding = stateTax * grossPay;
double deduction;
deduction = fedwithHolding + statewithHolding;
double netPay;
netPay = (grossPay) - deduction;
System.out.println("The netpay is " +netPay);
}
}