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

The sales commission for each salesperson at Cars-Inc. iscomputed based upon the

ID: 3608746 • Letter: T

Question

The sales commission for each salesperson at Cars-Inc. iscomputed
based upon the following percentage of his/her total sales:

      Total Sales (inUS$)         Commission
___________________________________________________
           sale <=35000             5%
    35000 < sale <=60000             7%
    60000 < sale <=90000             9%
    90000 <sale                      11%

Define the file stream *infile and link it to the given inputfile
"sales.dat" which is in the homework directory. Use
while(fgets()!=NULL) to read all the lines in "sales.dat". Forodd
number lines (containing names) print the name on the screen. For
even number lines (with sales), sscanf &sale and calculatethe
corresponding commission by using the above table; then print thesale
and the commission on the screen.
Finally, find the maximum value of the total sales. (You do nothave to
print the name of the best sales person since you need pointers tosave
the names.)

Note: Order the conditional expressions so that you do not have touse
the logical operators, || or &&. Specifically,if(35000<sale<=90000)
is incorrect since the expression consists of two conditional
expressions: 35000<sale and sale<=90000. The two expressionsmust be
joined by || or &&.    
...................................................................
Your output on the screen should look like:

John Everhart
sales= 75900.00 commission=   6831.00
Paul Evans
sales= 95700.00 commission= 10527.00
...........
......................................
Steven King
sales= 68000.00 commission=   6120.00
Anne Rice
sales= 130000.00 commission= 14300.00

The maximum sales value is .....

sales.dat info

John Everhart
75900
Paul Evans
95700
Juan Hernandez
45100
Rwanda Jackson
88500
Steve Jhonson
35800
Henry Chen
105000
Tracy Ravad
56000
Scott Peters
98000
Alex Ma
89800
Alma Roberts
34500
Nelson Shah
33800
Steven King
68000
Anne Rice
130000



Explanation / Answer

please rate - thanks I wish I had seen your code last night! I fixed yours up #include #include #include main() {         FILE *infile;         char text[81];         int count=0;         int tsales;         doublecommission,max=-1;         infile =fopen("../public/lecture/sales.dat", "r");         if(infile == NULL){ printf("The input file does not exist. ");          exit(1);          }         while(fgets(text, 81,infile)!=NULL){                count++;                if(count%2 == 0){                  sscanf(text, "%d", &tsales);                  if(tsales>max)                      max=tsales;                  if(tsales>90000)                     commission=.11;                  else                     if(tsales>60000)                         commission=.09;                     else                        if(tsales>35000)                            commission=.07;                        else                            commission=.05;                  printf("sales = $%d commission= %.2f ",tsales,commission*tsales);                } else                printf("%s", text);         }         printf("There are %dlines. ", count);         printf("The maximumsales value is %.2f ",max);         fclose(infile);         getch(); }
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