67 172
Assignments Done
99,3%
Successfully Done
In November 2018

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
Expert's answer
#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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions