Question: Write, test, and debug a program in Java (or any programming language you prefer) that contains two threads: Professor and StudentScheduler. The StudentScheduler thread will
Write, test, and debug a program in Java (or any programming language you prefer) that contains two threads: Professor and StudentScheduler. The StudentScheduler thread will create new Student objects at random intervals and place them in a shared memory queue of maximum length 5. Each Student object contains the Students name and the amount of time he/she needs to spend with the Professor. If the queue is full, the StudentScheduler thread will wait and not produce any more Students until there is a free spot in the queue. The Professor thread will remove Student objects from the queue and meet with each Student for the necessary length of time. If there are no Students in the queue, the Professor will play Halo on her computer until a new Student arrives. The Professor will leave and lock her office when there are no more Students to see for the day (she will know this because the StudentScheduler thread will terminate). The StudentScheduler thread will create a minimum of 15 and a maximum of 300 students.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
