ok i was given an assignment but i have no clue how to do this. can someone please explain to me what i'm supposed to do cause i'm really lost. this is the prompt.
The sales commission for each salesperson at Cars-Inc. is computed
based upon the following percentage of his/her total sales:
Total Sales (in US$) 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 input file
"sales.dat" which is in the homework directory. Use
while(fgets()!=NULL) to read all the lines in "sales.dat". For odd
number lines (containing names) print the name on the screen. For
even number lines (with sales), sscanf &sale and calculate the
corresponding commission by using the above table; then print the sale
and the commission on the screen.
Finally, find the maximum value of the total sales. (You do not have to
print the name of the best sales person since you need pointers to save
the names.)
Note: Order the conditional expressions so that you do not have to use
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 expressions must 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 .....
i'm really lost at:
Define the file stream *infile and link it to the given input file
"sales.dat" which is in the homework directory. Use
while(fgets()!=NULL) to read all the lines in "sales.dat". For odd
number lines (containing names) print the name on the screen. For
even number lines (with sales), sscanf &sale and calculate the
corresponding commission by using the above table; then print the sale
and the commission on the screen. i opened the file sales.dat and this is what it was:
sales.dat
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