"Gradebook" | |
Assigned: Weds Apr 16, 2003 | Design due: Mon Apr 23, 2003 |
Grade: 80 points | Due: Mon Apr 30, 2003 |
The "new" concepts covered in this program are:
We will also review a couple of the basics from good old CSC 160: basic file I/O and sorting. |
The Gradebook program manages the assignment scores
for a class of students. The program should have the following
basic capabilities:
READ - A Gradebook session starts with reading a scores file specified by the user. The format of this file is given below. CHANGE - When the user elects to change grades, the user is shown all the possible categories and must choose one. Then, the user is shown each student in the class and enters a score for the student on the selected assignment. VIEW - When viewing student scores, the user again must first choose the category to be viewed. Then, student scores on that assignment must be listed in descending order based on their score for that assignment. WRITE - Upon exiting, the user must be given the opportunity to save scores to a new file. You should only ask the user this if he/she has made changes to the scores. Student Scores File FormatThe format of the student scores file is:
The first line of the file defines the number of scores, <num_scores>, and number of students, <num_students>, for this class. The second line holds <num_scores> strings separated by commas. These strings define the names of the assignments for each score, things like "Homework" or "Final Exam". The remainder of the file contains <num_students> lines of scores, one per student. Each line should contain the student's name and then <num_scores> integers defining the scores for that student. Example Session Here's a possible example session (user input in bold/underline and shortcuts are C++ commented with //):
Implementation Your implementation must use pointers, rather than array subscripting throughout your program. Your objects and arrays should also be dynamically allocated wherever possible. Your implementation must use classes in an object-oriented approach. As a hint, I used the following classes in my solution:
Other hints:
|
Your program will be graded on three areas: design, quality, and function. Their description and weighting in your grade is given below. 1. Program Design (25%) It is essential to design your program before pounding it out in front of Visual C++. The design for this program requires:
You should include all the class interface files in your main() and be able to compile, but not build (or link) because your class member functions are not yet written. 2. Program quality (25%) I'm working on a more comprehensive style guide, but here's what I will be looking for:
3. Program function (50%) If your program doesn't compile or link, your grade for this section will automatically be cut in half and then I'll start from there. Please leave a README file in your prog01 folder with notes you want me to read. I will use your vending machine, of course... and, of course, it should work. I will be sure to try some error cases as well:
Good luck. |
I have a test file progr02/scores.txt in the Common Area. Apr 23, 2003 - Implementation notes/hintsNote #1 - Please create a destructor for any class that dynamically allocates memory. Delete any memory created for the object in the destructor. Note #2 - Remember that all arrays must be dynamically allocated. So, for example an array of integers must be declared as a pointer:
Also remember that arrays must be accessed using pointer arithmetic, rather than subscripting. For example:
must be replaced by:
Most of you will also have an array of StudentScores (or similar) objects. You can use the (what did the book call it again... hold on a second...ah, got it), the structure pointer operator, or ->, like this:
Note #3 - When dynamically allocating an array of objects, only the default constructor can be used, like this:
There is no way to call a constructor with arguments when creating an array of objects. You'll have to call separate member functions to further specify StudentScores or other objects after they are created. Note #4 - Make your classes as generic and reusable as possible. Do not put all user interaction in your GradeBook class, put it into main. Note #5 - I expect that you will struggle with your pointers, especially on the sorting part of this program. I urge you (again) to carefully study the example in the book on page 675. The sort in that example is very similar to what we are doing. Note #6 - Try reading in a GradeBook file that you have written.
|