CS 322 Fall 2013
Project 3 |
Synchronization
|
/Shared/cs322/submit/proj3It must contain two folders, each with one implementation, and include a readme with
You may work in groups of two. Collaboration within a group is, of course, unrestricted. You may discuss the program with members of other groups, but what you turn in must be your own group's work.
It is a violation to the Honor Code not to acknowledge others' work fully and openly.
You should cite any online resources you consulted to help you solve this project.
You may NOT directly copy any code or any text from anywhere.
Life in the salon is all walk-ins. There are no appointments and
clients are accepted as they arrive.
The salon operates as follows.
java HairSalon 5 > outputruns the program using 5 chairs in the waiting room and sends the program standard output to a file.
The user manually enters on the terminal as the program executes
The application runs until the user enters Ctrl+c on the console.
The application provides informative messages about the simulation, i.e. threads write output as they transit from one state to another.
An example of the console input is
beth 7 sammy 3 felix 4 lise 5 joe 4 aicha 4 mike 3 alma 5while the file containing the output produced by the running program is
beth enters the salon. beth sits down in the waiting room (chair 1). The stylist reluctantly finishes chatting with the receptionist. The stylist takes beth inside and starts the hair washing. sammy enters the salon. sammy sits down in the waiting room (chair 2). felix enters the salon. felix sits down in the waiting room (chair 3). The stylist finishes cutting beth's hair and blowing it dry (took 7). beth admires the new hair-style and leaves with a smile. The stylist takes sammy inside and starts the hair washing. The stylist finishes cutting sammy's hair and blowing it dry (took 3). sammy admires the new hair-style and leaves with a smile. The stylist takes felix inside and starts the hair washing. lise enters the salon. lise sits down in the waiting room (chair 2). joe enters the salon. joe sits down in the waiting room (chair 3). The stylist finishes cutting felix's hair and blowing it dry (took 4). felix admires the new hair-style and leaves with a smile. The stylist takes lise inside and starts the hair washing. aicha enters the salon. aicha sits down in the waiting room (chair 3). mike enters the salon. The receptionist tells mike to come back later, and he leaves, grumbling about the wait. The stylist finishes cutting lise's hair and blowing it dry (took 5). lise admires the new hair-style and leaves with a smile. The stylist takes joe inside and starts the hair washing. The stylist finishes cutting joe's hair and blowing it dry (took 4). joe admires the new hair-style and leaves with a smile. The stylist takes aicha inside and starts the hair washing. alma enters the salon. alma sits down in the waiting room (chair 2). The stylist finishes cutting aicha's hair and blowing it dry (took 4). aicha admires the new hair-style and leaves with a smile. The stylist takes alma inside and starts the hair washing. The stylist finishes cutting alma's hair and blowing it dry (took 5). alma admires the new hair-style and leaves with a smile. With no waiting clients the stylist resumes gossiping with the receptionist.
This project is graded out of 20 points.