Lesson 8: Hard Debugging

[spoiler title=”Lesson Video”]
Direct Download of Video (For mobile / offline viewing)(right click > save target as)

[/spoiler]

[spoiler title=”Lesson Source Code”]

```
#include <iostream>
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