Link to home
Start Free TrialLog in
Avatar of naturechan
naturechan

asked on

Question in reading a file and writing a report. (File I/O)

My instructor give me this problem, but I have no idea how to start it...
Can someone give me a big picture or outline on how to solve it?
THX!

Read in the input file below and produce the report shown.

Input file
John,Doe,123456789,20,21,22,23,16,19,16,50,75
Francisco,Washington,987654321,10,0,20,13,18,19,16,30,70
Tom,Nguyen,111111111,18,23,24,25,17,22,20,38,90
Victoria,Black,333333333,22,21,22,21,20,22,21,45,64
Sally,Seinfield,444444444,17,12,19,23,24,12,11,34,94
Sylvester,De La Rosa,555555555,25,25,24,20,25,25,21,44,80
George,O'Neill,666666666,21,12,3,14,21,14,17,45,99
Sylvia,Smart,777777777,20,21,22,23,24,20,25,44,78
Judy,Yang,888888888,16,19,22,24,25,20,25,45,100
Charles,Black,222222222,20,21,22,22,21,25,16,40,86

                            Class Grades Report

Student Name          --- SSN ---  ---- Lab Grades ----  Mid  Fin  Pts   Perct  G
--------------------  -----------  -- -- -- -- -- -- --  ---  ---  ---   -----  -
Doe, John             123-45-6789  20 21 22 23 16 19 16   50   75  246   82.0%  B
Washington, Francisc  987-65-4321  10  0 20 13 18 19 16   30   70  196   65.3%  D
Nguyen, Tom           111-11-1111  18 23 24 25 17 22 20   38   90  260   86.7%  B
Black, Victoria       333-33-3333  22 21 22 21 20 22 21   45   64  238   79.3%  C
Seinfield, Sally      444-44-4444  17 12 19 23 24 12 11   34   94  234   78.0%  C
De La Rosa, Sylveste  555-55-5555  25 25 24 20 25 25 21   44   80  269   89.7%  B
O'Neill, George       666-66-6666  21 12  3 14 21 14 17   45   99  243   81.0%  B
Smart, Sylvia         777-77-7777  20 21 22 23 24 20 25   44   78  257   85.7%  B
Yang, Judy            888-88-8888  16 19 22 24 25 20 25   45  100  280   93.3%  A
Black, Charles        222-22-2222  20 21 22 22 21 25 16   40   86  253   84.3%  B

•     Use C++ input/output techniques and file I/O, no stdio.  You should declare one ifstream and one ofstream object.
•     Create at least 3 classes:
1.     Name consists of a first and last name.
2.     StudentInfo consists of a Name, SSN, 7 lab grades, a midterm, final, and whatever else you want.
3.     Class consists of an array of StudentInfo or an array of StudentInfo pointers
•     The rules for calculating points and grades are exactly like the 1st assignment or what was stated on the course syllabus.  Remember to discard the lowest lab grade, but not the last one.
•     Use the same input file shown.
•     Produce exactly the report, with the same spacing, formatting and text.  Turn in a copy of the report file along with your program listing.
•     If you are unsure of any program detail, ask the instructor for clarification.

1.     Sort the report by Name (major sort by last name, minor sort by first name)
2.     Handle a missing lab score instead of a 0.  Use this record for Francisco Washington: Francisco,Washington,987654321,10,,20,13,18,19,16,60,140
3.     Change the lab grades in the input file to octal, but print them out as hexadecimal.
 
ASKER CERTIFIED SOLUTION
Avatar of Mayank S
Mayank S
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tinchos
tinchos

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Split points between mayankeagle & Salte

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Tinchos
EE Cleanup Volunteer