John Aromando
  • Home
  • Background

Check out my latest project!

Zooey - Virtual Assistant

Running A Barbershop Business

Project Details

        A barber shop has one or more barbers who service customers as they arrive on a first-come-first-serve basis.  Depending on the type of haircut a customer desires the service time varies.  A barber shop also has a limited number of chairs for waiting customers.  If all the chairs are filled, an arriving customer leaves without entering.  For this assignment you will simulate a barber shop with customers arriving at various times each requiring a variety of service times.  We are interested in observing the behavior of the barber shop at intervals of time.  To simulate customers arriving at you will use a queue and to simulate customers waiting in a barber shop you will use a circular queue where the size is equal to the number of chairs available.

        Your program will read a text file that contains a customer’s arrival time, his service time (i.e., the time the barber requires to give this customer the haircut he desires,) and his name.   Below is a sample input file.
 
       At each time interval report the customer that is arriving, the customer that is being serviced by the barber, and customers waiting in chairs.  If the barber shop is full (i.e., all the chairs are filled) an arriving customer leaves without a haircut.  (See the sample output file BarberShopOutput.docx.  For the sample, the barber shop has 3 chairs available.)  Your program needs to accommodate a variable number of chairs.

Text File

1 3 Bob
2 2 Jim
4 2 Bert
8 7 Greg
9 3 Tom
10 2 Earl
11 3 Jon
12 2 Bill

Output

Opening and reading file
Time = 0

Chairs are empty

Barber's chair is empty

Arrival List
Bob: arrival = 1: service = 3
Jim: arrival = 2: service = 2
Bert: arrival = 4: service = 2
Greg: arrival = 8: service = 7
Tom: arrival = 9: service = 3
Earl: arrival = 10: service = 2
Jon: arrival = 11: service = 3
Bill: arrival = 12: service = 2

-----------------------------

Time = 1

A chair is available
Bob sits

Chairs
Bob: arrival = 1: service = 3

Barber's chair is empty

Arrival List
Jim: arrival = 2: service = 2
Bert: arrival = 4: service = 2
Greg: arrival = 8: service = 7
Tom: arrival = 9: service = 3
Earl: arrival = 10: service = 2
Jon: arrival = 11: service = 3
Bill: arrival = 12: service = 2

-----------------------------

Time = 9

A chair is available
Tom sits

Chairs
Tom: arrival = 9: service = 3

Barber
Greg is chair 7 left

Arrival List
Earl: arrival = 10: service = 2
Jon: arrival = 11: service = 3
Bill: arrival = 12: service = 2

-----------------------------

Time = 10

A chair is available
Earl sits

Chairs
Tom: arrival = 9: service = 3
Earl: arrival = 10: service = 2

Barber
Greg is chair 6 left

Arrival List
Jon: arrival = 11: service = 3
Bill: arrival = 12: service = 2

-----------------------------

Time = 22

Chairs are empty

Barber
Jon is chair 2 left

Arrival List

-----------------------------

Time = 23

Chairs are empty

Barber
Jon is chair 1 left

Arrival List

-----------------------------

Customer Data Class

Waiting Chairs Class

Arrival Queue Class

Barber Class

Barbershop Class (Main Class)

Powered by Create your own unique website with customizable templates.
  • Home
  • Background