Salary Range Calculator help please!! =(
I do not know what I am doing wrong, but I can not figure this out for the life of me. Anyone know what is wrong with my program? I am trying to get it to input the sales for the week, then calculate 9% of that plus 200 dollars for each person, and output it on the chart, but for some reason the chart sticks all the people in the over 1000 dollar category. Im so confused =(
Code:
int main() //start program
{
//declare and initialize array
int rangeSales[9] = {0};
//declare and initialize variables
int salary = 200;
int grossSales = 0;
int commission = 0;
//Enter the gross sales for each salesperson
cout << "Enter the gross sales, enter -1 to stop: ";
cin >> grossSales;
cout << endl;
while(grossSales != -1)
{
commission = grossSales * .09;
salary = salary + commission;
if(salary >= 200 && salary <= 299)
rangeSales[0]++;
if(salary >= 300 && salary <= 399)
rangeSales[1]++;
if(salary >= 400 && salary <= 499)
rangeSales[2]++;
if(salary >= 500 && salary <= 599)
rangeSales[3]++;
if(salary >= 600 && salary <= 699)
rangeSales[4]++;
if(salary >= 700 && salary <= 799)
rangeSales[5]++;
if(salary >= 800 && salary <= 899)
rangeSales[6]++;
if(salary >= 900 && salary <= 999)
rangeSales[7]++;
if(salary >= 1000)
rangeSales[8]++;
//Enter the gross sales for each salesperson
cout << "Enter the gross sales, enter -1 to stop: ";
cin >> grossSales;
cout << endl;
} //end while
//display the count for each salary range
cout << "The count for $200-$299 range is: " << rangeSales[0] << endl;
cout << "The count for $300-$399 range is: " << rangeSales[1] << endl;
cout << "The count for $400-$499 range is: " << rangeSales[2] << endl;
cout << "The count for $500-$599 range is: " << rangeSales[3] << endl;
cout << "The count for $600-$699 range is: " << rangeSales[4] << endl;
cout << "The count for $700-$799 range is: " << rangeSales[5] << endl;
cout << "The count for $800-$899 range is: " << rangeSales[6] << endl;
cout << "The count for $900-$999 range is: " << rangeSales[7] << endl;
cout << "The count for over $1000 range is: " << rangeSales[8] << endl;
}