please use basic C a5. (15 points) (Sales Commissions) Use a single-subscripted
ID: 3598245 • Letter: P
Question
please use basic C
a5. (15 points) (Sales Commissions) 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% of their gross sales for that week. For example, a salesperson who grosses $3000 in sales in a week receives $200 plus 9% of $3000, or a total of $470, write a C 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): 8 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 Note: The program will ask frequently a new gross sales of salespersons until it encounters to -1 as a sentinel value.) Please submit a repl.it url link for your program.Explanation / Answer
See according to Chegg regulations i cannot attach a link in my answer but i will provide you with the code and Please do give it a THUMBS UP.
/*
Code is below*/
#include<stdio.h>
int main()
{
int count[9]={0};
int gross;
do
{
printf("Enter a gross amount or to EXIT enter -1 ");
scanf("%d",&gross);
if((gross*0.09+200>=200) && (gross*0.09+200)<=299)
count[0]++;
else if((gross*0.09+200>=300) && (gross*0.09+200)<=399)
count[1]++;
else if((gross*0.09+200>=400) && (gross*0.09+200)<=499)
count[2]++;
else if((gross*0.09+200>=500) && (gross*0.09+200)<=599)
count[3]++;
else if((gross*0.09+200>=600) && (gross*0.09+200)<=699)
count[4]++;
else if((gross*0.09+200>=700) && (gross*0.09+200)<=799)
count[5]++;
else if((gross*0.09+200>=800) && (gross*0.09+200)<=899)
count[6]++;
else if((gross*0.09+200>=900) && (gross*0.09+200)<=999)
count[7]++;
else if(gross*0.09+200>=1000)
count[8]++;
}while(gross!=-1);
/*
The following code can be used to print
and verify that the code is
running correctly
*/
int i=0;
for(i=0;i<9;i++)
printf("Count[%d] is %d ",i,count[i]);
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.