2012年2月22日 星期三

Exercise #15


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


                            CIS27 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


Program requirements
  • 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:
    • Name consists of a first and last name.
    • StudentInfo consists of a Name, SSN, 7 lab grades, a midterm, final, and whatever else you want.
    • 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. You may get a copy of the data file in the ATC if you do not want to type it in.
  • 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.

Extra Credit (1 point each)
  • Sort the report by Name (major sort by last name, minor sort by first name)
  • 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
  • Change the lab grades in the input file to octal, but print them out as hexadecimal.

沒有留言:

張貼留言