CS
210 – Fundamentals of Programming I
Spring 2007 – Programming
Project 1, Part B
70 points
Out:
March 21/22
Due: April 2/3
Part B of this first programming project is to implement the program you designed in Part A. The work must be entirely your own, except for any help you may get from the instructor. Submit your source file by emailing it as an attachment to cs210@csserver.evansville.edu by 4:30pm on the due date.
There are some extra implementation criteria that must be met for the project to earn full credit:
The implementation must incorporate any design comments given on your analysis and design. Graded analyses and designs will be returned in class on March 26/27 after Exam 2.
The program should allow names to contain spaces. I.e., instead of using the >> operator, a name should be read in using the getline string function covered in class on March 21/22. Note that like the get member function, if there is a use of the >> operator preceding getline, the trailing newline must be handled using the ignore member function.
The program should read the input data from a file rather than given interactively from the keyboard. The program should ask the user for the name of the file containing the data to be read in. (InteractiveOpen from the in-class exercise of February 22/26 should be used to do this). The data in the file will be in the same order as your original program expects to read it. For example, the data file equivalent to the example program run shown in Part A would be:
5 Doe, Jane 100 98 97 -1 Dopey, Gerald 0 24 88 66 -1 Hill, Howard 44 99 100 100 -1 Jones, Carmen 68 80 75 78 -1 Smith, Tony 69 85 76 -1
That is, the first line of the file will be the number of students, then a pair of lines for each student with the student's name on a line and then a line of the student's scores ending in a negative number. You should assume that the input file will be in the correct format.
Since the input data is being read from a file, there should not be any prompts to the screen for the data. See the example program run below.
The output should be in a formatted table with column headings as shown below in the example program run. The names should be left justified in a column and the averages should be right justified in a column. The average score must be displayed with exactly one place after the decimal point.
Other notes:
Your program must compile for it to be graded. Programs that do not compile will be returned for resubmission for half credit. Programs that substantially do not produce correct results also will be returned. Therefore, it is better to hand in a program late and working than to hand it in on-time and not working.
Follow the guidelines as shown in the on-line handout A C++ Programming. Style Guideline for CS 210.. As stated in the syllabus, part of the grade on a project depends on how well you document your program and adhere to the guidelines. The grader will look at your code listing and grade it according to the guidelines.
Example Program Run
If the file I:\grades.dat contains the data shown above, the output might look something like:
Welcome to CS 210 automated grade book program. Enter the name of the input file: I:\grades.dat The grades assigned are: Name Average Grade -------------------------------- Doe, Jane 98.3 A Hill, Howard 85.8 B Smith, Tony 76.7 C Jones, Carmen 75.3 C Dopey, Gerald 44.5 F
03/17/07