Create a Java console application that calculates the payroll for an organization. The application should allow the user to add any number of worker and manager hours with their associated hourly rates, as well as add payments to be made to contractors. When the user has finished entering data, the application should print out the total number of workers, managers, and contractors that will be paid. It should then print out the total gross pay, the total taxes withheld, and the net payout (gross - taxes).
Calculation Details
Managers and workers should collect overtime. Any hours over 40 should be paid at 1.5 times their normal pay rate.
Taxes should be calculated as follows based on a worker’s or manager’s pay (no payroll taxes should be taken out for contractors)
0 to $10,000: 5%
$10,001 to $20,000: 7.85%
Over $20,000: 8.975%
Implementation
The application should be based on a single class called PayrollCalculator.
All tax percentages should be hard-coded into the class as constants
The class should include at least the following public methods
addWorker(double rate, double hours)
addManager(double rate, double hours)
addContractor(double amount)
The main function should create a new PayrollCalculator and then enter a loop to gather user input (described in the next section)
User Interaction
When the application starts, it should ask the user to begin entering data. A typical interaction should appear as follows:
Please choose from the following options: ’W’ - enter a worker ’M’ - enter a manager ’C’ - enter a contractor ’D’ - complete calculations and print results
// Example - user enters ’W’ Please enter the worker’s pay rate: 100.00 Please enter the number of hours worked: 20
Please choose from the following options: ’W’ - enter a worker ’M’ - enter a manager ’C’ - enter a contractor ’D’ - complete calculations and print results
// user enters ’D’ RESULTS: Number of workers: 1 Number of managers: 0 Number of contractors: 0
Total Gross Salaries: (values here) Total Taxes Withheld: (values here) Net Payout: (values here)
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference
and should not be submitted as is. We are not held liable for any misuse of the solutions.
Please see the frequently asked questions page
for further questions and inquiries.
Kindly complete the form.
Please provide a valid email address and we will get back to you within 24 hours.
Payment is through PayPal, Buy me a Coffee
or Cryptocurrency.
We are a nonprofit organization however we need funds to keep this organization operating
and to be able to complete our research and development projects.