/* * Note to CS70 students: this is an incomplete header file. You must * complete it as you feel appropriate. Search for "ADD STUFF" to * find places you *MAY* need to change. */ /* * Note to CS70 students: the following two lines, plus the #endif * line at the end of the file, may be "magic" from your point of * view. They are necessary to get this assignment to work, and you * should always use similar code in any header file you write. We * will be covering their purpose later in class. */ #ifndef COURSE_HH #define COURSE_HH /* * Name: Geoff Kuenning * Course: CS 70, Spring 2001 * Assignment #3 * * This file defines the interface to the Course class, which is an * auxiliary class used by the Registrar_DB class (see registrar.hh). * * The Course class can track a single course by name. It allows the * course to be created and named, students to be enrolled and * deenrolled, and the current course data to be printed. */ #include /* * Table of contents: the following classes are defined in this file. */ class Course; /* * The following classes are used but not defined in this file. */ class Student; class ostream; /* * Interface to the Course class. */ class Course { public: /* * Constructors and destructors. We provide a zero-argument * constructor so that arrays of courses can be created. For * the current assignment, no other constructor is needed. */ Course(); ~Course(); /* * Pseudo-constructor. This is used to add information to a * course after it already exists, assuming that the course * was created as part of an array. It is very similar to an * assignment operator, which hasn't yet been covered in CS70. */ void fillInInfo(const string& department_, int courseNumber_, const string& meetingTime_, int maxEnrollment_); // Set or change course info /* * Informational functions. */ bool isFull() const; // Return true if course is at // ..maximum enrollment bool courseIs(const string& testDepartment, int testNumber) const; // Return true if course department // ..and number match parameters /* * Modification functions. */ bool addStudent(Student* enrollee); // Add a student to the course, // ..possibly also adding the course // ..to student's schedule // ..[depending on implementation]. // ..Return true if add was // ..successful, false if not done // ..(e.g., student already in // ..course) bool removeStudent(Student* dropper); // Remove a student from the course, // ..possibly also removing the // ..course from student's schedule // ..[depending on implementation]. // ..Returns true if remove was // ..successful, false otherwise // ..(e.g., student wasn't in the // ..course) void changeMeetingTime(const string& newMeetingTime); // Reschedule course /* * Display functions. */ ostream& showName(ostream& targetStream) const; // Display course name on a stream ostream& print(ostream& targetStream) const; // Display all course info on a stream private: /* * Disable copy/assignment. */ Course(const Course& source); Course& operator=(const Course& source); /* * Private functions. * ADD STUFF */ /* * Private data. * ADD STUFF */ string meetingTime; // e.g., "MWF 9" int maxEnrollment; // Maximum size of the roster Student** roster; // Students enrolled in course // ..kept alphabetized by name }; #endif // COURSE_HH