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,2 2,23,16,19 ,16,50,75
Francisco,Washington,98765 4321,10,0, 20,13,18,1 9,16,30,70
Tom,Nguyen,111111111,18,23 ,24,25,17, 22,20,38,9 0
Victoria,Black,333333333,2 2,21,22,21 ,20,22,21, 45,64
Sally,Seinfield,444444444, 17,12,19,2 3,24,12,11 ,34,94
Sylvester,De La Rosa,555555555,25,25,24,20 ,25,25,21, 44,80
George,O'Neill,666666666,2 1,12,3,14, 21,14,17,4 5,99
Sylvia,Smart,777777777,20, 21,22,23,2 4,20,25,44 ,78
Judy,Yang,888888888,16,19, 22,24,25,2 0,25,45,10 0
Charles,Black,222222222,20 ,21,22,22, 21,25,16,4 0,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,98765 4321,10,,2 0,13,18,19 ,16,60,140
3. Change the lab grades in the input file to octal, but print them out as hexadecimal.
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,2
Francisco,Washington,98765
Tom,Nguyen,111111111,18,23
Victoria,Black,333333333,2
Sally,Seinfield,444444444,
Sylvester,De La Rosa,555555555,25,25,24,20
George,O'Neill,666666666,2
Sylvia,Smart,777777777,20,
Judy,Yang,888888888,16,19,
Charles,Black,222222222,20
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,98765
3. Change the lab grades in the input file to octal, but print them out as hexadecimal.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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