Summary 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 Ensure the source code file named Payroll.cpp is open in the code editor. 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. Write the C++ code needed to perform the following: Calculate state withholding tax (stateTax) at 6.5 percent Calculate federal withholding tax (federalTax) at 28.0 percent. Calculate dependent deductions (dependentDeduction) at 2.5 percent of the employee’s salary for each dependent. Calculate total withholding (totalWithholding) as stateTax + federalTax + dependentDeduction. Calculate take-home pay (takeHomePay) as salary - totalWithholding. 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.25

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter8: I/o Streams And Data Files
Section: Chapter Questions
Problem 5PP: (Data processing) Write a C++ program that reads the file created in Exercise 4, permits the user to...
icon
Related questions
Question
100%

Summary

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:

    • Calculate state withholding tax (stateTax) at 6.5 percent
    • Calculate federal withholding tax (federalTax) at 28.0 percent.
    • Calculate dependent deductions (dependentDeduction) at 2.5 percent of the employee’s salary for each dependent.
    • Calculate total withholding (totalWithholding) as stateTax + federalTax + dependentDeduction.
    • Calculate take-home pay (takeHomePay) as salary - totalWithholding.
  4. 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.25
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr