Answer to Question #13235 in C++ for M Adnan ch

Question #13235
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
1
Expert's answer
2012-08-21T10:05:06-0400
#include <iostream.h>

int arr[10] = { 0, 2, 10, 3, 4, 5, 7, 3, 0, 1 }, i;
double sal;

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";
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS