Đang Thực Hiện

124748 Sleeping Barber

Problem Description:

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.

Details:

-The time cutting is random between 1 and 3 seconds

-The simulation must run for at least 2 minutes.

-Customers enter the store randomly between 1 and 3 seconds

-Cash register takes between 1 and 3 seconds cashing out a customer.

-Seconds are in whole numbers. (1,2 or 3)

The Console output should show the following:

-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

o The output should be in the following format:

ENTERING SHOP: Customer [1] entering barber shop for haircut.

Barber's asleep: Customer [1] is waking him up and getting hair

LEAVING SHOP: Customer [1] haircut finished: leaving shop.

ENTERING SHOP: Customer [2] entering barber shop for haircut.

Barber's asleep: Customer [2] is waking him up and getting hair

ENTERING SHOP: Customer [3] entering barber shop for haircut.

ENTERING SHOP: Customer [4] entering barber shop for haircut.

LEAVING SHOP: Customer [2] haircut finished: leaving shop.

Barber's busy: Customer [3] has waited and now wants haircut.

ENTERING SHOP: Customer [5] entering barber shop for haircut.

ENTERING SHOP: Customer [6] entering barber shop for haircut.

o Please include Source Code, and Class files

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

Xem thêm: sleeping barber java code, sleeping barber shop monitors, wake up now, the cash store, o 1 space, sleeping, java simulation, java console, five-to-go, chairs, barbershop, barber shop, java barbershop problem source code, class hair, cash register shop, barber cashier java, java sleeping barber, java semaphores, room shop, wake, waiting customers register, code format numbers, sleeping barber problem cashier, barbershop java semaphores, code barber problem

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

Mã Dự Án: #1870914

Đã trao cho:

roybuet

hi, plz check pmb. regards.

$70 USD trong 2 ngày
(0 Đánh Giá)
0.0