Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Salesperson Salary Ranges: Use a one- dimensional array to solve the following p

ID: 3758901 • Letter: S

Question

Salesperson Salary Ranges: Use a one- dimensional array to solve the following problem. A company pays its salespeople on a commission basis. The salespeople each receive $ 200 per week plus 9 percent of their gross sales for that week. For example, a salesperson who grosses $ 5000 in sales in a week receives $ 200 plus 9 percent of $ 5000, or a total of $ 650. Write a program (using an array of counters) that determines how many of the salespeople earned salaries in each of the following ranges (assume that each salesperson’s salary is truncated to an integer amount):

$200 - 299

$300- 399

$400 - 499

$500 - 599

$600 - 699

$700 - 799

$800 - 899

$900 - 999

1000 and over

need this in c++ with regaurds to object oriented programming

Explanation / Answer

#include <iostream>

#include <cmath>

using namespace std;

int main()

{

// Initialize array for 9 items

int rangeSales[9] = {0};

// Declare variables

int salary = 200;

int grossSales = 0;

int commission = 0;

cout << "Enter gross sales: ";

cin >> grossSales;

cout << endl;

while(grossSales != -1)

{

cout << "Enter gross sales: ";

cin >> grossSales;

cout << endl;

commission = grossSales * .09;

salary = salary + commission;

if (salary >= 200 && salary <= 300)

{

rangeSales[0]++;

}

else if (salary >= 300 && salary <= 399)

{

rangeSales[1]++;

}

else if (salary >= 400 && salary <= 500)

{

rangeSales[2]++;

}

else if (salary >= 500 && salary <= 600)

{

rangeSales[3]++;

}

else if (salary >= 600 && salary <= 700)

{

rangeSales[4]++;

}

else if (salary >= 700 && salary <= 800)

{

rangeSales[5]++;

}

else if (salary >= 800 && salary <= 900)

{

rangeSales[6]++;

}

else if (salary >= 900 && salary <= 1000)

{

rangeSales[7]++;

}

else if (salary >= 1000)

{

rangeSales[8]++;

}

} // end while

cout << "$200-$299 range is: " << rangeSales[0] << endl;

cout << "$300-$399 range is: " << rangeSales[1] << endl;

cout << "$400-$499 range is: " << rangeSales[2] << endl;

cout << "$500-$599 range is: " << rangeSales[3] << endl;

cout << "$600-$699 range is: " << rangeSales[4] << endl;

cout << "$700-$799 range is: " << rangeSales[5] << endl;

cout << "$800-$899 range is: " << rangeSales[6] << endl;

cout << "$900-$999 range is: " << rangeSales[7] << endl;

cout << "$1000 and up : " << rangeSales[8] << endl;

system("pause");

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote