Thread: Need help

  1. #1
    Registered User
    Join Date
    Jan 2011

    Exclamation Need help

    Can someone please help me with the following? I have absolutely no idea what I am doing. I've read the text and listened to the live lecture. I'm an online student and really learn better hands on. I'm so sorry and appreciate any help. Thanks

    C++ - 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 her total sales as her gross pay. Her federal tax rate is 18%. She contributes 10% to 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 . . .

    Pseudo Code:

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

    //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;

  2. #2
    Join Date
    Aug 2010
    somewhere in this universe
    where's your code???
    "All that we see or seem
    Is but a dream within a dream." - Poe

  3. #3
    Registered User \007's Avatar
    Join Date
    Dec 2010
    Start with the pseudo-code and start implementing your code. Come back when you hit a wall.

Popular pages Recent additions subscribe to a feed