Comp 1572, Winter 2002
Programming Assignment 4
Assigned February 15, 2002
Due Monday, March 4, 2002

Submission guidelines

As always, all code must be written individually and independently. Mail your source code (header file and .cpp file or files) to comp1572@cs.du.edu before class on the due date. The subject line should say Programming Assignment 4. The source code and header files should be sent as attachments. The naming conventions for these files will be announced in class. Turn in a hard copy of the header files and source code at the beginning of class on the due date. Also turn in a hard copy of a separate document which explains your program - this should include an explanation of the input and output of your program, the structure of your program (including a brief explanation of each function, the variables you are using in your program, etc.)

At the top of each file, put comments with your name, the date, course number, and assignment number. As always, write the program with a well organized structure, format it consistently, and document your program by naming functions and variables in a useful way, and by writing comments that would help someone understand how the code works so they could modify, enhance, or debug it. Functions should perform a specific and well-defined task that is described in comment lines above the function header. The logical flow of your program should be simple and easy to follow. Declarations of classes should be found in header files and implementations in separate .cpp files.

The problem

The problem is to write a program to manage a database of student records. The database consists of a a list of students for each year in school (freshman, sophomore, junior, senior). The information maintained for each student includes their first and last name, their student id number, their GPA, and their year in school.

The program should begin by displaying a menu for the user. This menu should include options to read the database in from a file, to write the current database to a file, to clear the database (empty it), to display the list of students, to display the list of students in a specific year, to add a new student, to find and display a student record by name, to find and and display a student record by id, to modify a student record (first or last name, id number, GPA or year in school), to delete a student record, to list the number of students in each year, and to quit the program. Re-display the menu and continue accepting commands until the user asks to quit.

Implementation requirements

Your program will be able to read in a database file - you must know in advance what the format of that file will be. Your program will also be writing database files, and it should write them in the same format. Here is the format: the first line will contain one number - the total number of students in the file. Each line that follows will represent a student record, and there will be exactly as many of these lines as there are students - the wrong number of lines constitutes a file error. Each line contains 5 elements, each separated by a space. The first element is their first name, followed by their last name, their student id number, their GPA and their class (which should say "Freshman", "Sophomore", "Junior", or "Senior". The records in the file are not guaranteed to be in any particular order. Your program should detect errors in the file, such as too few or too many student records, a GPA that isn't between 0 and 4, or an invalid class, and should take appropriate actions if it does.

Your program will store the student records (which are input by the user or read from a file) in a linked list. Each student record will be an object of a class StudentRec. This class will be a self-referential class with the following (private) data members:

The class StudentRec should have the following (public) member functions:

Your program will store four linked lists of these student records (one list for each school year), and each of these lists will be an object of the class StudentGroup. The class StudentGroup has the following (private) data members.

The class StudentGroup has the following (public) member functions:

Additionally, since each of your two classes have pointers to dynamically allocated memory, you must overload the copy operator and assignment operator and must provide a destructor for each class. The destructors must release all dynamically allocated memory as appropriate. You should imagine that your classes could be used by other client applications, and thus should be robust beyond your particular usage of them.

Milestone

By Feb 25 you should at the very least least be able to read a database file, store it in your StudentGroup and StudentRec classes, and display it. Before class on Feb 25, email a copy of your code to me, along with one paragraph telling me the status of the project. This milestone will be worth about 10% of your grade.