Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You have been hired by the CS Department to write code to help synchronize a professor and his/her students during office hours. The professor, of

You have been hired by the CS Department to write code to help synchronize a professor and his/her students during office hours. The professor, of course, wants to take a nap if no students are around to ask questions; if there are students who want to ask questions, they must synchronize with each other and with the professor so that

- only one person is speaking at any one time,

- each student question is answered by the professor, and

- no student asks another question before the professor is done answering the previous one.

You are to write four procedures: AnswerStart(), AnswerDone(), QuestionStart() and QuestionDone().

The professor loops running the code: AnswerStart(); give answer; AnswerDone(). AnswerStart doesnt return until a question has been asked. Each student loops running the code: QuestionStart(); ask question; QuestionDone(). QuestionStart() does not return until it is the students turn to ask a question. Since professors consider it rude for a student not to wait for an answer, QuestionEnd() should not return until the professor has finished answering the question. You can use a command line interface for this program. You are free to make other design choices and be creative in your implementation. You may use any programming language of your choice.

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

Step: 3

blur-text-image

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

Database Design For Mere Mortals

Authors: Michael J Hernandez

4th Edition

978-0136788041

More Books

Students also viewed these Databases questions

Question

=+Where do you want to live and work?

Answered: 1 week ago