Question: Write a java program: to drink a thirsty must have three things water, ice, and a glass. There are three thirsty people, each having a
Write a java program:
to drink a thirsty must have three things water, ice, and a glass. There are three thirsty people, each having a different one( and only one) of the three required items. A fourth person , a server , has an unlimited supply of all three items. If nobody is drinking the server places two of the three items( chosen at random) onto a table. The thirsty person who can make a drink from two items will pick them up and drink a glass of water. When done, the thirsty person will notify the server and the process will repeat. Write a program that uses a monitor to control the three thirsty people and the server. For concurrency use only synchronized, wait(), notifyAll(), and also sleep().
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
