Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

HOW WOULD I COMPLETE THIS ACTIVITY ON ECLIPSE WITHOUT SHOWING ERRORS!!!! PLEASE HELP!!!!! This activity will enable you to apply what you learn during this

HOW WOULD I COMPLETE THIS ACTIVITY ON ECLIPSE WITHOUT SHOWING ERRORS!!!! PLEASE HELP!!!!!

This activity will enable you to apply what you learn during this course. In this assignment, you will write, test, and debug a Java program or any other programming language you prefer that contains two threads Professor and StudentScheduler. Professor Smith is seeing students during office hours at NYU. She can only see one student at a time, and students will wait patiently outside while another student is with the professor. There are exactly five chairs outside the professors office. If all the chairs are full, no more students may wait outside. But they can come back later and check to see if a chair has opened up. An office visit can take anywhere from 1 to 5,000 milliseconds. When a student exits the professors office, the student who is in the first chair may enter. The rest all slide down. This continues until there are no more students who need to see the professor. 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. Be sure to use synchronized methods or code blocks where appropriate to avoid concurrency anomalies.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

More Books

Students explore these related Databases questions