#include using namespace std; #include using std:: string; #include // forward declaration, so that methods of Job can reference the // variable schedule. class Job; // schedule is a list of pointers to jobs. Initialized to the empty list. static list schedule = list(); class Job { public: string ID; int Length, StartTime; // constructor for Job: initialize Length, ID, and add job to schedule. Job(string I, int L): // fill in body. Note: The library method L.push_front(X) adds X to list L. // compute end time of job int EndTime() { // fill in body } // set start time of job void sched(int Start) { // fill in } // check that this job does not overlap with any other job on the schedule // KEYWORDS OMITTED HERE! check() { // fill in } }; // end Job class ReleaseJob: public Job { public: int ReleaseTime; // constructor public: ReleaseJob(string I, int L, int R): // fill in constructor // Check release time constraint inline bool RCheck() { return StartTime >= ReleaseTime; } // Check that both the release time constraint holds and that the "check" // method associated with Job holds. You should _call_ the check method // for Job; do not copy the code. // KEYWORDS MISSING HERE check() { // fill in } }; // end ReleaseJob class DueJob: public Job { public: int DueTime; // constructor public: DueJob(string I, int L, int R): // fill in constructor // check due time constraint. inline bool DCheck() { // fill in } // Check that both the due time constraint holds and that the "check" // method associated with Job holds. You should _call_ the check method // for Job; do not copy the code. // KEYWORDS MISSING HERE check() { // fill in } }; // end DueJob class PredJob: public Job { public: list Preds; // constructor public: PredJob(string I, int L, list P): // fill in constructor bool PCheck() { // fill in } // Add a predecessor J to this void AddPred(Job* J) { // fill in } // Check that both the predecessor constraints hold and that the "check" // method associated with Job holds. You should _call_ the check method // for Job; do not copy the code. // KEYWORD MISSING HERE check() { // fill in } }; // end PredJob // check that the schedule is correct by checking that each job is correct. // I have given you this code to illustrate how lists are used in C++ // DO NOT CHANGE THIS CODE. bool checkSchedule() { bool ok= true; for (list::iterator it = schedule.begin(); ok && it != schedule.end(); it++) { ok = ((*it)->check()); } return ok; } // Top level driver. DO NOT CHANGE THIS CODE. int main() { Job J1("A",4); ReleaseJob J2("B",5,2); DueJob J3("C",6,10); PredJob J4("D",7,list()); J4.AddPred(&J1); J4.AddPred(&J3); J1.sched(0); J2.sched(30); J3.sched(4); J4.sched(12); cout << checkSchedule() << "\n"; // Should print out 1 J3.sched(3); cout << checkSchedule() << "\n"; // Should print out 0 J3.sched(5); cout << checkSchedule() << "\n"; // Should print out 0 J3.sched(4); J1.sched(40); cout << checkSchedule() << "\n"; // Should print out 0 }