Devam Ediyor

404412 Modified Sleeping Barber Prog

Description: A modified Sleeping Barber Problem

You must provide a methodology, design, Java Implementation and results (do not include packages or jar files in your final submission) for this assignment (see Problem below). Submit your assignment in a ZIP file to WebCT, with clearly defined parts. The submission will include Word or Text files and the java source and class files. Each deliverable must be clearly labeled, including your name and course title. See the Deliverables section for details.

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. Customers are processed in the order that they are seated, earliest has highest priority, except for one condition, a priority customer that has made an appointment, when this customer enters, he/she is now the next customer to get a hair cut, all other customers are moved back one, if more than one priority customer enters the shop, he/she is placed behind then last priority customer, for example assume two priority customers have entered the shop plus 3 regular customers and the left side is next available of the queue.

Priority customer 1, priority customer 2, customer 3, customer 4, customer 5

Entry Times are

Priority customer 1 entered store at 10:01:00

Priority customer 2 entered the store at 10:01:08

Customer 3 entered before customer 4

Customer 4 entered before customer 5

Note: in the case of priority customers, you really can't make a regular customer leave, that would not be nice, so you should extend the queue to support the additional moved back customer (customer is now standing, because there are no chairs).



• The time cutting is random either 1 or 2 seconds

• The simulation must run for at least 2 minutes.

• Customers enter the store between 2 and 4 seconds (randomly


• Cashier takes 1 second cashing out a customer. (randomly selected)

• Priority customers enter between 8-10 seconds.

• Seconds are in whole numbers.

Notes: Your simulation must show the following console output


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

• Number of customers at all points, 1 second intervals, (waiting,cutting, sleeping, cashing out, leaving, entering

• When the barber is asleep. (state change awake/sleep sleep/awake)

• When the cashier is asleep. (state change awake/sleep sleep/awake)

• When the chairs are full. (customer turned away, except in the case of priority customers)

• The number of customers waiting to pay

• When a customer enters or leaves the shop

• Total time for each customer from entry to exit

• Priority customers must be marked as such

• Queue length

• Number of customers standing and sitting


The finished project will include the following

• A single file containing design specification for this project

• Any additional Java Source code.

• The executables (class files)

• Any other source files necessary to build your system.

• A detailed README file describing the how to use application

• Design Documentation that includes at least (1) state and (2) flow

diagrams, description of all (3) classes and (4) methods, all attributes passed to the (5) methods and (6) classes, (7) methodology, (8) problem definition.

Beceriler: Her şey Kabul, Java, Web Sitesi Yönetimi

Daha fazlasını gör: wake up now, use case includes, use case include example, use case extend, use case diagrams include, use case diagrams extend, use case diagrams example, use case diagrams, the cash store, single-case design, single case design, room specification, java 1.5 documentation, java 1.4 documentation, includes in use case, include extend use case, include and extend in use case, how to design your room, haircut design, flow section

İşveren Hakkında:
( 1 değerlendirme )

Proje NO: #2150272