Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Theprogram calculates the amount of tax withheld from an employee s weekly salary, the taxdeduction to which the employee is entitled for each dependent, and

Theprogram calculates the amount of tax withheld from an employee s weekly salary, the taxdeduction 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, dependenttax deductions, salary, and take-home pay.

1. Open the source code file named Payroll.cpp using Notepad or the text editor of your choice.

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:

a. Calculate state withholding tax at 6.5 percent, and calculate federal withholdingtax at 28.0.

b. Calculate dependent deductions at 2.5 percent of the employee s salary for eachdependent.

c. Calculate total withholding. (Total withholding is the total state withholdingcombined with the total federal withholding.)

d. 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

5. Compile the program.

6. Execute the program.

You should get the following output:

State Tax: $81.25

Federal Tax: $350

Dependents: $62.5

Salary: $1250

Take-Home Pay: $881.25

7. In this program, the variables salary and numDependents are initialized with the values 1250.00 and 2.

To make this program more flexible, modify it to acceptinteractive input for salary and numDependents .

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 Universal Database V7.1 Application Development Certification Guide

Authors: Steve Sanyal, David Martineau, Kevin Gashyna, Michael Kyprianou

1st Edition

0130913677, 978-0130913678

More Books

Students also viewed these Databases questions