Đã hoàn thành

124078 Java Barbershop Semaphore

A barbershop has a cutting room with one chair and a waiting room with five chairs. A limitless number of customers enter the waiting room one at a time if space is available, otherwise they go to another shop. Each time the barber finishes a haircut, the customer must pay at the cash register, only one customer may pay at a time, addition customers waiting to pay must wait, if the cashier is asleep, the paying customer must wake the cashier up, after paying the customer leaves to go to another store, if the cashier has no waiting customers, the cashier falls asleep. A waiting customer, if there is one, enters the cutting room and has a haircut. Customers may enter the waiting room one at a time, or waiting customer may enter the (empty) cutting room one at a time, but these events are mutually exclusive. If the barber discovers that the waiting room is empty, the barber falls asleep in the waiting room. An arriving customer, finding the barber asleep, wakes the barber and has a haircut, otherwise the arriving customer waits. Use must use java semaphores/monitors to coordinate the operation of the barber, clients and the cash register.

Notes: Your simulation must show the following console output

? Status of the barber, clients and cashier when any changes occur.

? Number of customers at all points, at all times.

? When the barber is asleep.

? When the cashier is asleep.

? When the chairs are full.

? The number of customers waiting to pay

***** I am including my code. Please modify to use Semaphore and fix the Cashier class.

Kĩ năng: Bất kì công việc gì, Java

Xem nhiều hơn: java barbershop semaphore, barbershop java semaphores, the cash store, java simulation, java console, java + fix, five-to-go, chairs, barbershop, barber shop, modify java code, cash register shop, barber cashier java, java semaphores, room shop, wake, waiting customers register, modify java class, java modify, cash register code, fix java code, semaphores, semaphore barber java, java barbershop, barbershop java semaphore

Về Bên Thuê:
( 5 nhận xét )

ID dự án: #1870244

Được trao cho:


Will modify your sources to use the [login to view URL] API.

$50 USD trong 2 ngày
(25 Đánh Giá)