P-1. (Salesperson Salary Ranges) Use a one-dimensional array to solve the following problem. A company pays its sales people on a commission basis. The sales people each receive 9 percent of their gross sales for that week so their salaries are variable. Write a program (using an array of counters) that determines how many of the sales people earned salaries in each of the following ranges (assume the user enters different salaries).
Example:
a) $200–299 2 employees
b) $300–399 10 employees
c) $400–499 3 employees
d) $500–599 4 employees
e) $600–699 5 employees
f) $700–799 7 employees
g) $800–899 3 employees
h) $900–999 0 employees
i) $1000 and over 1 employee
void main(){ cout<<"enter the salary value please: "; cin>>sal; for(i=1;i<=9;i++){ if ((i*100<=sal)&&(sal<(i+1)*100)) cout<<arr[i-1]<<" employees\n"; } if (sal>=1000) cout<<arr[9]<<" employees\n"; }
Comments
Leave a comment