[spoiler title=”Lesson Video”]
Direct Download of Video (For mobile / offline viewing)(right click > save target as)
[/spoiler]
[spoiler title=”Lesson Source Code”]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#include
using namespace std;
int main(){
//9>8 == true == 1, 1>7 ==false
//nested if's
//if inside of an if
//Homework: If the salesperson made less than 4000 in a month, they do not get any bonus
//Fix all the if statements so that they work properly
//Bonus: If the person made over 15000, they get a 100 bonus added to their check after commision has been factored in.
// ==, <, > < !=, >=, <=, !, &&, ||
double pay = 0.0, comission = 0.0, sales = 0.0;
cout << "Enter the salesperson's sales for the month: ";
cin >> sales;
if (sales > 4000 && sales <5000){
comission = 0.01;
}
else if (sales >5000 && sales < 6000){
comission = 0.02;
}
else if (sales >6000 && sales < 7000){
comission = 0.03;
}
else if (sales >7000 && sales < 8000){
comission = 0.04;
}
else if (sales >8000 && sales < 9000){
comission = 0.05;
}
else{
comission = 0.08;
}
pay = 400;
//cout << "Pay = " << pay << " -- comission = " << comission << "\n\n";
cout << "\nThe salesperson's pay for the month is: " << (pay*(1 + comission)) << endl;
system("PAUSE");
return 0;
}
|
[/spoiler]
Homework: No homework this lesson