Titus Jr I.

asked • 11/15/20

Understanding Sequential Statements

In this lab, you complete a C++ program with the provided data files. 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.

Instructions

  1. Ensure the source code file named Payroll.cpp is open in the code editor.
  2. Variables have been declared and initialized for you as needed, and the input and output statements have been written. Read the code carefully before you proceed to the next step.
  3. Write the C++ code needed to perform the following:
  4. Calculate state withholding tax (stateTax) at 6.5 percent
  5. Calculate federal withholding tax (federalTax) at 28.0 percent.
  6. Calculate dependent deductions (dependentDeduction) at 2.5 percent of the employee’s salary for each dependent.
  7. Calculate total withholding (totalWithholding) as stateTax + federalTax + dependentDeduction.
  8. Calculate take-home pay (takeHomePay) as salary - totalWithholding.
  9. Compile and execute your program by clicking the Run button. You should get the following output:
State Tax: $81.25
Federal Tax: $350
Dependents: $62.5
Salary: $1250
Take-Home Pay: $756.2


1 Expert Answer

By:

Patrick B. answered • 11/15/20

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.