Calculate Payroll
Write a program that can be used to calculate a worker’s expected wages, deductions and net pay based upon the hours worked and pay rate, both entered by the user.
The following percentages are to be used as constants in your program for calculation of withholdings:
• Federal tax withholding rate: 15%
• State tax withholding rate: 4%
• City tax withholding rate: 2%
• Social Security tax rate: 6.2%
• Medicare tax rate: 1.45%
You may declare any additional variables as needed
For this assignment, you are to write six (6) methods, in addition to your main method, as itemized below.
1. Write a method that will allow the user to input the number of hours worked OR their pay rate as separate individual calls to this method. Since both of these values are of type double, you should be able to write one method to accommodate both data items with the only thing changing in each case being the query to the user (“Enter Hours Worked: ” or “Enter Pay Rate: “). This method will contain a loop structure that will iterate until proper input is achieved (data validation). When finished, you should have a generic method that returns a double and can be used throughout your work whenever you need a method to return a validated double. I would suggest that you write similar methods for other data types. You will find this useful in the future. The header of this method should look something like:
private static double GetDoubleAmount(String prompt) prompt = question to the user
2. Write a method that calculates and returns their total pay by multiplying the hours worked times their pay rate.
3. Write a single method that can be used to calculate and return each deduction individually. For instance, this method will be able to calculate both federal OR state taxes by changing only the values sent to the formal parameters via arguments. From this, you will see the true value of methods.
4. Write a method to output pay:
Hours Worked: 41.25
Pay Rate: 20.00
Pay:
Gross Pay 825.00
5. Write a method to output deductions:
Deductions:
Federal Tax 123.75
State Tax 33.00
City Tax 16.50
Social Sec 51.15
Medicare + 11.96
-------
Total Deductions 236.36
6. Write a method to output net pay:
Net Pay 588.64
All together, your output will be:
Enter Hours Worked: 41.25
Enter Pay Rate: 20
Hours Worked: 41.25
Pay Rate: 20.00
Pay:
Gross Pay 825.00
Deductions:
Federal Tax 123.75
State Tax 33.00
City Tax 16.50
Social Sec 51.15
Medicare + 11.96
-------
Total Deductions 236.36
Net Pay 588.64
BONUS CHALLENGE: (20 points) Modify the above requirement to incorporate overtime pay for hours worked over 40 hours. The overtime rate will be 1.5 times their pay rate for those hours worked over 40. Below are 2 runs of this program, one with hours > 40 (overtime accounted for) and one with hours <= 40:
Enter Hours Worked: 41
Enter Pay Rate: 20
Hours Worked: 41.00
Pay Rate: 20.00
Pay:
Regular Pay: 800.00
OT Pay + 30.00
-------
Gross Pay 830.00
Deductions:
Federal Tax 124.50
State Tax 33.20
City Tax 16.60
Social Sec 51.46
Medicare + 12.04
-------
Total Deductions 237.80
Net Pay 592.20
Enter Hours Worked: 40
Enter Pay Rate: 20
Hours Worked: 40.00
Pay Rate: 20.00
Pay:
Gross Pay 800.00
Deductions:
Federal Tax 120.00
State Tax 32.00
City Tax 16.00
Social Sec 49.60
Medicare + 11.60
-------
Total Deductions 229.20
Net Pay 570.80
Once you are completed, save the source code file (.java). Don't forget to put the following information in your submitted file as code comments: Your name Project Name
Date Description of Program Developed and Compiled using // Doug Streitenberger // Chapter 5 Programming Assignment // Today’s Date // This program... // Developed and compiled using NetBeans Finally, click on the link to attach the completed .java file. When you have finished attaching your solution, don't forget to press the SUBMIT button.

Payroll Java Assignment

$40.00Price
  • File includes Assignment and Complete Java executable Code. 

INDIA : +91-995-314-1035                                              USA: +1-628-888-9041

                 Rights Reserved - VARCHAS IT SYSTEMS PVT.LTD 

                  Terms of Service  |   Privacy Policy

  • Facebook
  • Twitter
  • YouTube
  • Instagram

privacy policy right reserved research paper