You need to 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 7% of his or her total sales as his or her gross pay. His or her federal tax rate is 18%. He or she contributes 10% to his or her retirement program and 6% to Social Security.

Output: Display the results

Sample Output from Lab 1:
Enter Weekly Sales: 28000

Total Sales:       28000.00
Gross pay (7%):      1960.00

Federal tax paid:      352.80
Social security paid:    117.60
Retirement contribution:  196.00
Total deductions:      666.40

Take home pay:       1293.60
Press any key to continue . . .

Flowchart: (continued on next page)

 

 

 

 

Pseudo Code:

 

  1. 1.     Declare variables
  2. 2.    Accept Input - weeklySales
  3. 3.    Calculate Gross Pay = Weekly Sales * .07
  4. 4.    Calculate Federal Tax = Gross Pay * .18
  5. 5.    Calculate Social Security = Gross Pay * .06
  6. 6.    Calculate Retirement = Gross Pay * .1
  7. 7.    Calculate Total Deductions = Federal Tax + Social Security + Retirement
  8. 8.    Calculate Total Take Home Pay = Gross Pay - Total Deductions
  9. 9.    Display the following on separate lines and format variables with $ and decimal.
    1. a.    Total Sales Amount:        value of weekly sales
    2. b.    Gross Pay (.07):           value of gross pay
    3. c.    Federal Tax paid (.18):      value of federal tax
    4. d.    Social Security paid (.06):    value of social security
    5. e.    Retirement contribution (.1):  value of retirement
    6. f.      Total Deductions:          value of total deductions
    7. g.    Take Home Pay:           value of take home pay

 

Note: Use SetPrecisions(2) to format the output (see page 98 of the text). The statements should look something like the following:

 

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

#include <iomanip>

 

//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.07):\t $" << setw(8) << grossPay << endl;

 

 

    • 12 years ago
    CIS170 Lab 1 in C++
    NOT RATED

    Purchase the answer to view it

    blurred-text
    • attachment
      screenshot_cis170_lab1.jpg
    • attachment
      cis170_week1lab.zip