




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The final system design for a course scheduling system in a computer science department. It includes a class diagram, design specifications using c++ structures, and explanations on how the design evolved. The system aims to schedule courses based on input about classrooms, lecture times, and instructor preferences, while satisfying certain conditions.
Typology: Study Guides, Projects, Research
1 / 8
This page cannot be seen from the preview
Don't miss anything!





// This is the specification for the Object-Oriented Design for the Case Study. // It gives all the major classes and most of the major data members and // operations for these classes. The major parameters of the various operations // are also given, which shows how objects are being made visible. All the // major object declarations are also given. Comments are added only where // they are needed over and above the discussions above.
class Course { private: char *courseID; public: *tellCourseID (); isAValidID (); // To test whether courseID is invalid bool isAPGCourse (); void setAttr (char *); };
class Room { private: int roomNo; int capacity; public: Room (int num, int cap); bool tellAttrib (int &num, int &cap); bool areAttribValid (); // Atrribute validation };
Figure 1: Final class diagram for the case study (cont.)
class LectureSlot { private: char *slotID; public: char *tellSlotID (); bool isAValidSlot (); void setAttr (char *id); };
// Generic List Abstraction template
// Next two operations needed to traverse the list void reset (); // Reset the CurrentPtr, if you want to scan from start bool getNextElement (Element_t &element); // In tables we will represent a room, course, etc. as an index in its DB. // Operations for random access in the list are therefore needed. bool getIthElement (int, Element_t &); bool setIthElement (int, Element_t); };
// Abstraction for room database class RoomDB { private: List<Room *> roomDB; public: bool insert (Room *); void sortRooms (); // Sort on capacity - makes looking for a room easier bool getSuitableRoom (enrol); // get smallest room that fits };
// Abstraction for course database class CourseDB { private: List<Course *> courseDB; public: bool insert (Course *); bool lookUp (int &, Course &); // Search the DB and return the index };
// Abstraction for class database class SlotDB { private: List<LectureSlot *> slotDB; public: bool insert (LectureSlot *); bool lookUp (int &, LectureSlot &); // Return index of the lecture slot };
// Object for File 1 class InputFile_1 { private: ifstream inFile; char *fileName; // Parsing functions bool semicolonExists (char *); // TRUE if semicolon is present in the line bool buildRoomDB (RoomDB &); // Parse file until roomDB is built bool build_CS_DB (CourseDB &, SlotDB &); // Build course and slot DBs char skipOverWhiteSpaces (); void getNextRoomEntry (int &, int &, int &); void getNextToken (int &, char *&); public: build_CRS_DBs (char *fName,CourseDB &cDB, RoomDB &rDB, SlotDB &sDB); };
// A course that has to be scheduled - from file 2. Forms the base class class CtoBeSched {
List<CtoBeSched *> table [NUM_OF_CATEGORIES]; PGReserve *pgReserve; // Reservation chart for PGsansP public: bool scheduleAll (TimeTable *&, SlotDB *,RoomDB *, ConflictTable *&); // Sends getScheduled message to all courses bool insert (int, CtoBeSched *); };
class TimeTableEntry { // One entry in the timetable private: int coursePtr; // Index into Course DB bool booked; // Some other course booked it? public: void setAttr (int cptr, bool mark); bool isThisBooked (); int tellWho (); void printEntry (CourseDB *cDB); };
class TimeTable { private: int PGOccupied[ MAX_SLOTS ]; TimeTableEntry table[ MAX_ROOMS ][ MAX_SLOTS ]; public: bool bookASlot (int, int, int); // Set table[i][j] = ptr ; bool isColumnEmpty (int colIndex); bool setPGOccupied (int slotIndex,int coursePtr); int PGwho (int coursePtr); int who (int roomPtr, int slotPtr); void printTimeTable (CourseDB *, RoomDB *, SlotDB *); bool isAlreadyOccupied (int roomPtr, int slotPtr); huntForSuitableRoom (int, int, RoomDB *, int &); };
class ConflictTable_Entry { private: int errorCode; int coursePtr; int conflictCourse; int preference; int roomPtr; public: void setAttr (int E, int c,int cc,int p,int r); void printAttr (CourseDB *,SlotDB *,RoomDB *); };
class ConflictTable { private: List< ConflictTable_Entry *> table; public: bool insertEntry (int, int, int, int, int); void printTable (CourseDB *,SlotDB *,RoomDB *); };
class InputFile_2 {
private: char *fileName; // Parsing functions char skipOverWhiteSpaces (); char *getNextToken (); char *getNextPref (); bool prefGiven (); public: bool buildCtoBeSched (char *fName, TableOfCtoBeSched &, CourseDB *, SlotDB *); };
main (int argc, char *argv[]) { InputFile_1 in1; InputFile_2 in2; TableOfCtoBeSched tbl; CourseDB cDB; RoomDB rDB; SlotDB sDB; TimeTable *timeTable; ConflictTable *conflictTable;
// From main, first the databases are built by in1.build_CRS_DBs() // Then table from file 2 is built by in2.buildCtoBeSched( ) // Rooms are then sorted, and scheduling is done by tbl.scheduleAll( ) // Timetable and conflict table are then printed. }