#include <iostream>
#include <iomanip>
int main()
{
//declare variables
int sales = 0;
double commission = 0.0;
//enter input
cout << "Sales: ";
cin >> sales;
//determine commission
if (sales < 0)
commission = -1;
else if (sales <= 100000)
commission = sales * .02;
else if (sales <= 400000)
commission = (sales - 100000) * .05 + 2000;
else
commission = (sales - 400000) * .1 + 17000;
//end if
//display commission or error message
if (commission != -1)
{
cout << fixed << setprecision(2);
cout << "Commission: $" << commission << endl;
}
else
cout << "The sales cannot be less than 0." << endl;
//end if
system("pause");
return 0;
}
cant treat commission as an int
Under your #include
s:
using namespace std;
Last edited on
and you cant have .float. you need 0.float