This page is accessible at www.se.rit.edu/~se441/Assignments/STM-Vending.html.
For this activity, you will work with the group assigned by your instructor to create an STM based vending machine. If you are wise, you'd consider doing this by renaming and modifying the EnergySource program. For our simulation, one day = one second.
The vending machine holds two distinct items: Cookies and Candy. While payment would be a necessary part of any real vending machine, we'll ignore this and concentrate on the vending of items only. Customers can request either a cookie, a candy bar, or a pair (one cookie, one candy). The vending machine reports either success or failure (it fails when an item requested is not available).
The vending machine initially has 6 of each item. Every three days (three seconds) the vending maching company representative shows up and adds enough cookies and candy to hit the inventory of 6 each.
There are five regular customers of the vending machine:
You are to simulate 1/2 month's activity (15 seconds), after which you should shut down the simulation gracefully. Your vending machine must manage the inventory counts using shared transactional memory for each of the items. While this is bad practice in general, you should put print statements inside the transactions clearly identifying the customer, what he is trying to do, and the state of the system. To keep things readable, mid-transaction messages should be indented 4 spaces for Cookie Monster, 8 spaces for Willie Wonka, and 12 spaces for Fat Albert.
Submit your source files in a zip file (and only a zip file) named vending.zip to the Vending Activity dropbox. Your static void main method must be in the file Main.java, and all source files must be in the default package. An annotated trace output, Trace.txt, must be included in the archive showing the output from a representative simulation run. You may but need not) include a README.txt file in the archive with information about your program, including limitations, known defects, and commentary on the output produced.
Of the 10 points available for this activity,
In all cases, points assigned represent your instructor's judgement as a professional engineer, and are not subject to negotiation.