Understanding Sequential Statements
In this lab, you complete the Java program provided with the data files for this book. The program calculates the amount of tax withheld from an employee's weekly salary, the tax deduction to which the employee is entitled for each dependent, and the employee's take-home pay. The program output includes state tax withheld, federal tax withheld, dependent tax deductions, salary, and take-home pay.
1. Open the source code file named Payroll . java using Notepad or the text editor of your choice.
2. Variables have been declared and initialized for you as needed, and the output statements have been written. Read the code carefully before you proceed to the next step.
3. Write the Java code needed to perform the following:
• Calculate state withholding tax at 6.5 percent, and calculate federal withholding tax at 28.0 percent.
• Calculate dependent deductions at 2.5 percent of the employee's salary for each dependent.
• Calculate total withholding.
• Calculate take-home pay as salary minus total withholding plus deductions.
4. Save this source code file in a directory of your choice, and then make that directory your working directory.
5. Compile the program.
6. Execute the program. You should get the following output:
• State Tax: 581.25
• Federal Tax: $350.000000000000006
• Dependents: $62.5
• Salary: $1250.0
• Take-Home Pay: $881.25
7. In this program, the variables named salary and numDependents are initialized with the values 1250.0 and 2. To make this program more flexible, modify it to accept interactive input for salary and numDependents. Name the modified version Payroll2 . java.
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.