Question: Using C++. Write a program that calculates and displays the take-home pay for a commissioned sales employee along with all of the deductions. Input :

Using C++. Write a program that calculates and displays the take-home pay for a commissioned sales employee along with all of the deductions.

Input: Prompt the user for the weekly sales.

Process: Perform the calculations. The employee receives 8% of his or her total sales as his or her gross pay. His or her federal tax rate is 16%. He or she contributes 8% to his or her retirement program and 6% to Social Security.

Output: Display the results

Sample Output:

Enter Weekly Sales: 32000

Total Sales: 32000.00

Gross pay (8%): 2560.00

Federal tax paid: 409.60

Social security paid: 153.60

Retirement contribution: 204.80

Total deductions: 768.00

Take home pay: 1792.00

Pseudo Code:

Declare variables

Accept Input - weeklySales

Calculate Gross Pay = Weekly Sales * .08

Calculate Federal Tax = Gross Pay * .16

Calculate Social Security = Gross Pay * .06

Calculate Retirement = Gross Pay * .08

Calculate Total Deductions = Federal Tax + Social Security + Retirement

Calculate Total Take Home Pay = Gross Pay - Total Deductions

Display the following on separate lines and format variables with $ and decimal.

Total Sales Amount: value of weekly sales

Gross Pay (.08): value of gross pay

Federal Tax paid (.16): value of federal tax

Social Security paid (.06): value of social security

Retirement contribution (.08): value of retirement

Total Deductions: value of total deductions

Take Home Pay: value of take home pay

Note: Use Set Precision (2) to format the output. The statements should look something like the following:

//include the iomanip header file at the top of the file

#include

//use fixed and setprecision(2) to format the number

//use setw(8) to control the width of the field

//use \t to control the spacing between fields

cout << fixed << setprecision(2);

cout << "Gross Pay (0.08):\t $"<< setw(8) << grossPay << endl;

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!