Question
Im 99% certain this is wrong, but this is what I have #include #include /* initialising main function */ int main(void) { { float sales,
Im 99% certain this is wrong, but this is what I have
#include
/* initialising main function */ int main(void) { { float sales, commission, earnings;
while(true) { printf( "Enter sales in dollars : " ); scanf( "%f", &sales );
if ( sales == -1 ) /*establishing the if/else function*/ { return 0; }
commission = sales / 100 * 9; /* indicates commission percentaged added to salary */ earnings = commission + 200; /* weekly salary */
printf( "Salary is %.2f ", earnings ); } return 0; }; int size = sizeof(salesPersonSalary) / sizeof(int);
int i = 0; int count = 0;
/* number of people who earned $200-299 */ for (i = 0; i = 200 && salesPersonSalary[i]
printf("Number of sales person who earned there salary in range $200-299 are %d ", count);
/* number of people who earned $300-399 */ count = 0; for (i = 0; i = 300 && salesPersonSalary[i]
printf("Number of sales person who earned there salary in range $300-399 are %d ", count); /* number of people who earned $400-499 */ count = 0; for (i = 0; i = 400 && salesPersonSalary[i]
printf("Number of sales person who earned there salary in range $400-499 are %d ", count); /* number of people who earned $500-599 */ count = 0; for (i = 0; i = 500 && salesPersonSalary[i]
printf("Number of sales person who earned there salary in range $500-599 are %d ", count); /* number of people who earned $600-699 */ count = 0; for (i = 0; i = 600 && salesPersonSalary[i]
printf("Number of sales person who earned there salary in range $600-699 are %d ", count); /* number of people who earned $700-799 */ count = 0; for (i = 0; i = 700 && salesPersonSalary[i]
printf("Number of sales person who earned there salary in range $700-799 are %d ", count); /* number of people who earned $800-899 */ count = 0; for (i = 0; i = 800 && salesPersonSalary[i]
printf("Number of sales person who earned there salary in range $800-899 are %d ", count); /* number of people who earned $900-999 */ count = 0; for (i = 0; i = 900 && salesPersonSalary[i]
printf("Number of sales person who earned there salary in range $900-999 are %d ", count); /* number of people who earned $1000 and over */ count = 0; for (i = 0; i = 1000) count++; } printf("Number of sales person who earned there salary more than $1000 are %d ", count); return 0; /* end function main */ {while (num != -1) printf("Enter next number (-1 to end) "); scanf("%d", & num); if (num == -1) break; /* indicates end of input */ } } /* end programme */
Q5. (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) 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 programStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started