stuck on new school project

hey, I just started taking c++ and did the first couple projects ok but this one has me stumped. a large company pays salespeople on a commission basis. The salespeople each receive 200$ per week plus 9% of their gross sales for that week.
Make a program that uses a while statement to input each salespersons gross sale for the last week and calculates and displays that sales persons earnings process one salespersons figures at a time.

Sorry so long any help would be awesome. Thank you
Last edited on
OK, some information about while statement:

http://www.geocities.com/learnprogramming123/Clesson10.htm

I suggest using do-while loop. In loop you should write 'Please type the gross sale in last week (for exit type negative number)' then read a numbert to float type variable because you can multiple with 1.09 (9 percent) if the typed number isn't negative.

The exiting conditional of while loop is the typed number is't negative.

That's all.
Write your code and I help you.
Post your code, tell us where you are stuck.
#include <iostream>
using namespace std;

const double COMMISION_RATE = .09;



int main()
{
double grossSales=0 . 0;
double takeHomePay=0 . 0;
cout << "Do you wish to report a weekly sales (enter -1 to quit) " << endl;
cin >> grossSales;

while(grossSales != -1)
{
takeHomePay = 200 + (grossSales * COMMISSION_RATE);

// cout line 1

// cout line 2
cout << "Do you wish to report a weekly sales (enter -1 to quit)" << endl;
cin >> grossSales;
}




system("PAUSE");
return 0;




}
Having problems coming up with the output statement need it to look something like this

example

Enter sales in dollars (-1 to end): 5000.00
Salary is : $650.00
Use code tags... the # icon on the right.

Read your book, cin/cout is the first thing in it.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>
using namespace std;

const double COMMISION_RATE = .09;

int main()
{
    double grossSales=0.0;
    double takeHomePay=0.0;
    cout << "Do you wish to report a weekly sales (enter -1 to quit) " << endl;
    cin >> grossSales;

    while(grossSales != -1)
    {
        cout << "text" << endl;
        takeHomePay = 200 + (grossSales * COMMISSION_RATE);
        cout << "some more text" << andaVariable << endl;
        cout << "Do you wish to report a weekly sales (enter -1 to quit)" << endl;
        cin >> grossSales;
    }

    return 0;
}
Last edited on
Topic archived. No new replies allowed.