CS162 Lab 1: Classes
For this lab you will maintain a database of student test scores and respond to transactions on the database. Allow for up to 200 students, and 8 test scores per student. Record each student's name, social security number (ssno), and test scores. The ssno field is a key field and unique for each student. Provide the ability to add/drop students and record test scores. If a student is dropped, their name should no longer appear on output, and their slot in the array should be reused. Support output that displays detailed information for a single student, all students sorted by name (increasing), or all students sorted by average test score (decreasing). No error checking is required.
The following source files are available in this zip archive:
- driver.cpp — test driver
- Roster.h — Roster class interface
- outputRoster.txt — sample output
Save the driver.cpp and Roster.h files in your project directory and specify Project > Add Existing Item to include the files as part of our project. Your task is to write the implementation (Roster.cpp) for the Roster class.
I want to make sure you get started in the right direction so we will have a design review of the specification file in class. If you miss the design review then show me your design before you code the implementation. When done, turn in files Roster.h and Roster.cpp. See syllabus for details.
Checklist
Did you participate in the design review, or show me your design?
Did you follow the coding conventions in the C++ Style guide?
Did you use the C++ string class to store the student's name? Although you could do this with a character array, it's much easier to use the string class. And, since you can assign and compare strings, your code will be simpler.
Did you implement the Roster class as two files: Roster.h and Roster.cpp?
Is your program efficient? How do you drop/add students? Does it take longer if there are many students?
Did you re-use slots in the array? For example, if you have a full array can you drop a student and then add another one?