/* * Note to CS70 students: this is an incomplete source file. You must * complete it as you feel appropriate. Search for "ADD STUFF" to * find places you *MAY* need to change. * * Note that many comments are missing. We have not provided "ADD * STUFF" hints for missing comments. */ /* * Name: Geoff Kuenning * Course: CS 70, Spring 2004 * Assignment #3 */ #include "course.hh" #include "student.hh" #include #include using namespace std; /* * Table of Contents: the following routines are defined in this file: * * Student::Student(); * Student::~Student(); * void Student::fillInInfo(const string& firstName_, * const string& lastName_, const string& hairColor_); * // Fill in student info * string Student::name() const; * // Return student's full name * bool Student::hasMaximumLoad() const; * // True if can't add any more courses * void Student::changeHairColor(const string& newColor); * // Dye student's hair * bool Student::addCourseToSchedule(Course* course); * // Insert course in schedule; * // ..also adds student to course if * // ..needed. Returns true if course * // ..was added, false otherwise * // ..(e.g., if course was already * // ..there, or no room) * bool Student::removeCourseFromSchedule(Course* course); * // Remove course from schedule; * // ..also removes student from * // ..course if needed. Returns true * // ..if course was removed, false * // ..otherwise (e.g., if course * // ..wasn't in schedule) * ostream& Student::print(ostream& targetStream) const; * // Produce representation of student * void Student::dropAllCourses(); * // Remove student from all enrollment */ Student::Student() : fullName(), hairColor(), courseCount(0) { // ADD PSEUDOCODE } Student::~Student() { // ADD STUFF (PSEUDOCODE NOT NEEDED) } /* * Pseudo-constructor to fill in student information after the fact. * This should really be done using a copy constructor and assignment * operator, but I'm not 100% sure we'll have covered them in time. */ void Student::fillInInfo( const string& firstName_, const string& lastName_, const string& hairColor_) { // ADD STUFF (PSEUDOCODE NOT NEEDED) } /* * Return the student's full name in "last, first" format. Depending * on how this function is implemented, it might be possible to return * a "const string&", which would make it more efficient. However, * the "string" return type declaration is necessary if the full name * is constructed "on the fly", and causes no harm in other * situations, so I have chosen that form. */ string Student::name() // Return student's full name const { // ADD STUFF (PSEUDOCODE NOT NEEDED) } bool Student::hasMaximumLoad() // True if can't add any more courses const { // ADD STUFF (PSEUDOCODE NOT NEEDED) } void Student::changeHairColor( // Dye student's hair const string& newColor) // New color to give to hair { // ADD STUFF (PSEUDOCODE NOT NEEDED) } bool Student::addCourseToSchedule( // Insert course in schedule Course* course) // Course being added { // ADD PSEUDOCODE } bool Student::removeCourseFromSchedule( // Remove course from schedule Course* course) // Course being removed { // ADD PSEUDOCODE } ostream& Student::print( // Produce representation of student ostream& targetStream) // Stream to print to const { // ADD STUFF (PSEUDOCODE NOT NEEDED) // THIS ROUTINE SHOULD PRODUCE THE FULL STUDENT OUTPUT: NAME, HAIR // COLOR, AND COURSE LIST return targetStream; } void Student::dropAllCourses() // Remove student from all enrollment { // ADD PSEUDOCODE }