Question: Create a class called NetPay to compute a persons gross and net pay based on their hourly wage, hours worked, and several withholdings. All statements

Create a class called NetPay to compute a persons gross and net pay based on their hourly wage, hours worked, and several withholdings. All statements should be defined in the main method of the class (except for declarations of constants). The output of the program should look similar to this: Hours per Week: 40 Gross Pay: 290.0 Net Pay: 225.765 Deductions Federal: 29.0 State: 13.05 Social Security: 17.98 Medicare: 4.205 Implementation Details: To make the outputs line up on the right-hand side, you will need to use the tab character \t in your print statements. You may need one or more \t characters in each line. Play around with it until the output lines up. You will use the number of hours per week to compute the gross pay, net pay, and the deductions. You will need to create a variable for each value above. Brainstorm the proper data types. Hours per week is your input to the program. For exercise 1, you will type it into the program. For exercise 2 (below), it will come from the keyboard. You will also need to declare named constants and initialize them to the values shown. o FEDERAL_TAX_PERCENT: 10.00. o STATE_TAX_PERCENT: 4.5. o SS_PERCENT: 6.2. o MEDICARE_PERCENT 1.45. o PAY_PER_HOUR 7.25. Questions to consider (do not need to record): How do we compute gross pay? Store the result in the variable created for gross pay. How do we compute federal tax? Think about using gross pay and federal tax percent. Compute state tax, social security contribution, and medicare using similar methods as federal tax. How do we compute net pay? Display the values on the screen in the order listed above. Once your program is implemented, compile and run your program. Afterwards, edit your program by changing the value assigned to the variable for hours per week. Do this in the code for now. We will do user input in part 2. Additional sample executions are shown below. Your program may have more digits after the decimal point shown than the examples below, and that is okay as long as your programs output is within 0.01 of the answer shown. Hours per Week: 30 Gross Pay: 217.5 Net Pay: 169.32375 Deductions Federal: 21.75 State: 9.7875 Social Security: 13.485 Medicare: 3.15375 Hours per Week: 35 Gross Pay: 253.75 Net Pay: 197.544375 Deductions Federal: 25.375 State: 11.41875 Social Security: 15.7325 Medicare: 3.679375 Hours per Week: 40 Gross Pay: 290.0 Net Pay: 225.765 Deductions Federal: 29.0 State: 13.05 Social Security: 17.98 Medicare: 4.205 Hours per Week: 45 Gross Pay: 326.25 Net Pay: 253.985625 Deductions Federal: 32.625 State: 14.68125 Social Security: 20.2275 Medicare: 4.730625 Modify NetPay.java to ask the user for the number of hours worked (it is no longer typed into the program). Note: you do not need to submit exercise 1 only submit a single java file after completing both exercises. Which preexisting Java class did we use to read in keyboard input? Reference the textbook or class slides and borrow the necessary code from there (you dont have to memorize this code). Dont forget to prompt the user to enter the number of hours per week. Compile and run your program. A run of your program should look like the example below (the blue (bold) is the users input it is not being output by the program). Your program may have more digits after the decimal point shown than the examples below, and that is okay as long as your programs output is within 0.01 of the answer shown. Hours per Week: 100 Gross Pay: 725.0 Net Pay: 564.4125 Deductions Federal: 72.5 State: 32.625 Social Security: 44.95 Medicare: 10.5125 You should run your program with various inputs, and test that your program is producing correct outputs. For every programming lab and project this semester, you are responsible for ensuring that your program doesnt contain any syntax, runtime, or logical errors. Always test, test, and retest the programs you create.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!