Suppose you are a salesman, selling widgets, working on a commission.
Your company pays you monthly commission according to the following:
For the first 10 widgets you sell, there's no commission
For the next 40 widgets you sell, you get $1 per widget
For the next 50 widgets you sell, you get $2 per widget
For the next 100 widgets you sell, you get $5 per widget
For any widgets you sell after that, you get $3 per widget
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
if ( widgets <= 10 )
com = widgets * 0;
cout << "Commission: " << "$" << com << endl;
if ( widgets >= 11 && widgets <= 40)
com = widgets * 1;
cout << "Commission: " << "$" << com << endl;
if ( widgets >= 41 && widgets <= 50 )
com = widgets * 2;
cout << "Commission: " <<"$" << com << endl;
if ( widgets >= 51 && widgets <= 100 )
com = widgets * 5;
cout << "Commission: " << "$" << com <<endl;
if ( widgets > 100)
com = widgets * 3;
cout << "Commission: " << "$" << com << endl;
|
I don't understand why the example say if you input 200 you gonna get 640
another one 1000200 you get 3000640