Executive Director of the HelpDesk Service came under withering criticism from members of the Committee on Undergraduate Studies this week, as additional reports surfaced of turned-away students and unusually long wait times.
"My constituents are very, very concerned about these latest reports," stated the Committee chairperson, who then launched into a detailed criticism of existing HelpDesk Service policies. "Students are being turned away from the HelpDesk just because a classmate from the same course is already being helped, while other students from higher numbered courses just sit and wait."
"This is a totally stupid algorithm for running a HelpDesk Service," lamented another Committee member after the hearing. "You shouldn't be interrupting students already receiving help just because another student from a lower-numbered class shows up."
Similar reactions were elicited from department members unconnected to the HelpGate affair. As one UPE officer put it, "Why would you turn away students when there are plenty of chairs for them to wait in? Haven't these people heard of queues?"
Following the hearings, the HelpDesk Service announced that a comprehensive review of policies and procedures is underway, with a report on proposed changes due back to the Committee by next week Thursday.
This assignment uses several Queues to simulate a HelpDesk for computer science students.
Unlike the previous HelpDesk policy, students will no longer be turned away when the HelpDesk is currently helping a student from a lower-numbered course. Instead, they will be directed to a waiting area with chairs. The waiting area is organized into four subdivisions -- one for the 1000-level courses, one for the 2000-level courses, one for the 3000-level courses, and one for the 4000-level courses. Each subdivision has three chairs for waiting students, and students in a subdivision will be helped in first-in, first-out order.
When a student arrives at the HelpDesk, if no one is currently being helped, and no one is in the waiting area, the student will be helped immediately. If someone is being helped, the student will be sent to the back of the line for the level of course in which they are seeking help.
When the current student being helped leaves, the HelpDesk will choose the next student from the 1000-level waiting area chairs to help first. If there are no students waiting in the 1000-level chairs, the first student in the 2000-level chairs will be helped, and so on.
If a student arrives and the waiting area for their level is full (all three chairs occupied), that student may be sent to the end of the waiting list for the next level up. Only if a student's waiting level is full, and all higher levels are also full, will a student be turned away.
The HelpDesk tutor still keeps track of who is coming and going, using a pile of notecards. When the shift is over, the notecards are read back and logged in first-to-last order. (The previous logs were in reverse order.)
Your HelpDesk class will be tested for the following API:
Input to the HelpDesk simulator will consist of an initial line with a number of minutes for the simulation to run.
Each subsequent line of input will consist of an arrival time (in minutes), a name, a course number (we assume all courses are COSC, and therefore the letter code is not included,) and a workload time in minutes.
Input arrival times will occur strictly in order -- so each student's arrival will be strictly greater than or equal to the previous student's. You may assume that workload times will be strictly positive, non-zero integers.
Here are some example inputs and outputs.
Time 0, IDLE
Time 1, IDLE
Time 2, Helping Jack from COSC1010
Time 3, Helping Jack from COSC1010
Time 4, IDLE
Time 5, Helping Jill from COSC1020
Time 6, Helping Jill from COSC1020
Time 7, IDLE
Time 8, Helping Robin from COSC2010
Time 9, IDLE
LOG:
Time 2, Started helping Jack from COSC1010
Time 4, Finished helping Jack from COSC1010
Time 5, Started helping Jill from COSC1020
Time 7, Finished helping Jill from COSC1020
Time 8, Started helping Robin from COSC2010
Time 9, Finished helping Robin from COSC2010
Time 0, IDLE
Time 1, IDLE
Time 2, Helping Robin from COSC2010
Time 3, Helping Robin from COSC2010
Time 4, Helping Robin from COSC2010
Time 5, Helping Robin from COSC2010
Time 6, Helping Robin from COSC2010
Time 7, Helping Robin from COSC2010
Time 8, Helping Robin from COSC2010
Time 9, Helping Robin from COSC2010
Time 10, Helping Jill from COSC1020
Time 11, Helping Jill from COSC1020
Time 12, Helping Jill from COSC1020
Time 13, Helping Jill from COSC1020
Time 14, Helping Jill from COSC1020
Time 15, Helping Jill from COSC1020
Time 16, Helping Jack from COSC1010
Time 17, Helping Jack from COSC1010
Time 18, IDLE
Time 19, IDLE
LOG:
Time 2, Started helping Robin from COSC2010
Time 5, Queued Jill from COSC1020
Time 7, Queued Jack from COSC1010
Time 10, Finished helping Robin from COSC2010
Time 10, Started helping Jill from COSC1020
Time 16, Finished helping Jill from COSC1020
Time 16, Started helping Jack from COSC1010
Time 18, Finished helping Jack from COSC1010
Time 0, IDLE
Time 1, IDLE
Time 2, Helping Robin from COSC2010
Time 3, Helping Robin from COSC2010
Time 4, Helping Robin from COSC2010
Time 5, Helping Robin from COSC2010
Time 6, Helping Robin from COSC2010
Time 7, Helping Robin from COSC2010
Time 8, Helping Robin from COSC2010
Time 9, Helping Robin from COSC2010
Time 10, Helping Jill from COSC1020
Time 11, Helping Jill from COSC1020
Time 12, Helping Jill from COSC1020
Time 13, Helping Jill from COSC1020
Time 14, Helping Jill from COSC1020
Time 15, Helping Jill from COSC1020
Time 16, Helping Jack from COSC3100
Time 17, Helping Jack from COSC3100
Time 18, IDLE
Time 19, IDLE
LOG:
Time 2, Started helping Robin from COSC2010
Time 3, Queued Jack from COSC3100
Time 4, Queued Jill from COSC1020
Time 10, Finished helping Robin from COSC2010
Time 10, Started helping Jill from COSC1020
Time 16, Finished helping Jill from COSC1020
Time 16, Started helping Jack from COSC3100
Time 18, Finished helping Jack from COSC3100
Time 0, IDLE
Time 1, IDLE
Time 2, Helping Jack from COSC4300
Time 3, Helping Jill from COSC4300
Time 4, Helping Robin from COSC4300
Time 5, Helping Batman from COSC4300
Time 6, IDLE
Time 7, IDLE
LOG:
Time 2, Started helping Jack from COSC4300
Time 2, Queued Jill from COSC4300
Time 2, Queued Robin from COSC4300
Time 2, Queued Batman from COSC4300
Time 2, Turned away Joker from COSC4300
Time 3, Finished helping Jack from COSC4300
Time 3, Started helping Jill from COSC4300
Time 4, Finished helping Jill from COSC4300
Time 4, Started helping Robin from COSC4300
Time 5, Finished helping Robin from COSC4300
Time 5, Started helping Batman from COSC4300
Time 6, Finished helping Batman from COSC4300
[Revised 2014 Oct 01 13:22 DWB]