Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PLEASE HELP me figure out what is wrong with this code. #include<stdio.h> int ma

ID: 3727203 • Letter: P

Question

PLEASE HELP me figure out what is wrong with this code.

#include<stdio.h>

int main()

{

int numEmp = 0;

int count[9]={0,0,0,0,0,0,0,0,0};

int gross;

  

printf("Enter the number to employees: ");

scanf("%d", numEmp);

  

for (numEmp=0; numEmp<=9;numEmp++);

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);

  

int i=0;

for(i=0;i<9;i++)

printf("Count[%d] is %d ",i,count[i]);

  

return 0;

}

5 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 $3000 in sales in a week receives $200 plus 9 percent 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): 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

Explanation / Answer

#include<stdio.h>

int main()

{

int numEmp;

int count[9]={0,0,0,0,0,0,0,0,0};

int gross;

int i=0;

printf("Enter the number to employees: ");

scanf("%d",&numEmp);

int salesPersons[numEmp];

for (i=0; i<numEmp;i++){

printf(" Enter a gross Sales of %d Sales Person : "+(i+1));

scanf("%d",&gross);

// int com=(gross*0.09)+200;

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]++;

}

// int i=0;

for(i=0;i<9;i++)

printf("Count[%d] is %d ",i,count[i]);

return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote