Hi together i need your help... again for my lab work.
The question is the following:
Use a single-subscripted array to solve the following problem. A company pays its
salespeople on a commission basis. The salespeople 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):
a) £200–£299
b) £300–£399
c) £400–£499
d) £500–£599
e) £600–£699
f) £700–£799
g) £800–£899
h) £900–£999
i) £1000 and over
Sample Screen Output
Enter employee gross sales (-1 to end): 10000
Employee Commission is £1100.00
Enter employee gross sales (-1 to end): 4235
Employee Commission is £581.15
Enter employee gross sales (-1 to end): 600
Employee Commission is £254.00
Enter employee gross sales (-1 to end): 12500
Employee Commission is £1325.00
Enter employee gross sales (-1 to end): -1
Employees in the range:
£200-£299 : 1
£300-£399 : 0
£400-£499 : 0
£500-£599 : 1
£600-£699 : 0
£700-£799 : 0
£800-£899 : 0
£900-£999 : 0
Over £1000: 2
what i have got so far:
#include <iostream>
#include <iomanip> // use to be able to set precision
using std::cin;
using std::cout;
using std::endl;
using std::setprecision;
int main ()
{
double comission;
double salary;
int grosssales;
int salespeople; // want to make the program independent on number of sales people
int count1 = 0; // individual counter for each salary range
int count2 = 0;
int count3 = 0;
int count4 = 0;
int count5 = 0;
int count6 = 0;
int count7 = 0;
int count8 = 0;
int count9 = 0;
cout << "This program determines the number of salespeople earning salaries in various different ranges." << endl;
cout << "The salespeople receive " << char ( 156 ) << "200 plus 9 percent of their gross sales that week." << endl;
cout << "Please enter the number of sales people." << endl;
cin >> salespeople; // enter the number of sales people to know how often to repeat the loop
cout << "Please enter the salespersons gross sales in GBP ( " << char ( 156 ) << " )" << endl;
cin >> grosssales; // type in the number of goss sales per salesperson to have basis for calculation for comission
comission = 0.09 * grosssales; // define comission
salary = comission + 200;
if ( comission <= 299 )
++count1;
if ( 300 <= comission <= 399 )
++count2;
if ( 400 <= comission <= 499 )
++count3;
if ( 500 <= comission <= 599 )
++count4;
if ( 600 <= comission <= 699 )
++count5;
if ( 700 <= comission <= 799 )
++count6;
if ( 800 <= comission <= 899 )
++count7;
if ( 900 <= comission <= 999 )
++count8;
if ( 1000 <= comission )
++count9;
cout << "Employee's comission is " << char ( 156 ) << setprecision (2) << comission << endl;
cout << "Employee's salary is " << char ( 156 ) << setprecision (2) << salary << endl;
return 0;
}// end program
any hints please
thank you