// Job.cpp Dave Reed 9/9/03 // // Job class implementation /////////////////////////////////////////////////////////////////////////////// #include "Job.h" Job::Job(int id, int arrival, int len) // Assumes: id is unique, arrival and len >= 0 // Results: constructs a job object, initializes executedSoFar to 0 { jobID = id; jobArrivalTime = arrival; jobLength = len; executedSoFar = 0; } int Job::GetID() const // Returns: returns ID number of the job { return jobID; } int Job::GetArrival() const // Returns: returns arrival time of the job { return jobArrivalTime; } int Job::GetLength() const // Returns: returns length of the job { return jobLength; } JobStatus Job::Execute() // Assumes: job is not done yet (executedSoFar < length) // Returns: status (OK or DONE) after executing the job for a cycle { executedSoFar++; if (executedSoFar >= jobLength) { return DONE; } else { return OK; } }