You are on page 1of 2

Write a program that prompts the user for:

An employee name

The number of hours worked

The hourly pay rate

The federal tax withholding rate (in decimal format)

The state tax withholding rate (in decimal format)

The program should output the information provided plus the following:

Gross Pay (hours * hourly pay rate)

Federal Tax withholding (given percentage of gross)

State Tax withholding (given percentage of gross)

Total Deduction (Federal Tax + State Tax)

Net Pay (Gross Pay Total Deduction)

You will need:

1. Objects for the Scanner and NumberFormat classes (you will need to use the
getCurrencyInstance and getPercentInstance)

2. Variables to store (at a minimum)

1. An employee name

2. The number of hours worked

3. The hourly pay rate

4. The federal tax withholding rate (in decimal format)


5. The state tax withholding rate (in decimal format)

You can create additional variables to store the calculated values or you can embed your calculated
results in the output. (Tip: Creating additional variables can make it a little easier to debug if
corrections are to be made.)

3. Comments to indicate:

4. The goal of the program

5. Input and prompts

6. Calculations and output

(You can add as many additional comments as you like, but the ones indicated below are
the minimum.)

A sample of the output is shown below:

Enter employee's name: John Smith


Enter number of hours worked in a week: 10
Enter hourly pay rate: 9.75
Enter federal tax withholding rate (as decimal): 0.2
Enter state tax withholding rate (as decimal): 0.09

Employee Name: John Smith


Hours Worked: 10.0
Pay Rate: $9.75

Gross Pay: $97.50


Deductions:
Federal Tax @ 20%: $19.50
State Tax @ 9%: $8.78
Total deduction: $28.27
Net Pay: $69.22

You might also like