Hi guys, I am doing the “If Statements” lesson in the C++ course and having trouble with the commission calculator project.
The issue is that when I multiply two variables together it always results in 0.
Here is my code.
#include
#include
#include
using namespace std;
int main() {
double sales;
cout << "Sales: ";
cin >> sales;
double commissionRate = 0;
if (sales <= 10000) double commissionRate = .10;
else if (sales <= 15000) double commissionRate = .15;
else double commissionRate = .20;
double commission = commissionRate * sales;
cout << "Your Commission is: " << commission << endl;
cout << commissionRate;
return 0;
}
The issue I have is that it always says your commission is 0 no matter what I input for sales.
Does anyone know what I am doing wrong?