HW3 1. The vending machine (VMC) system requirements are as follows: The VMC dispenses goods: (1) very large candy (VC) at 15¢, (2) large candy (LC) at 10¢, and (3) a small candy (SC) at 5¢. The vending machine only deals in nickels, and dimes. The VMC gives the proper change after the product selection is made. The VMC must tabulate the amount being deposited. The following rule applies to the VMC’s behavior: a) The VMC remains idle until a customer or owner begins to interact with the VMC. When a selection button is depressed the VMC indicates the required amount needed. b) If the full amount needed has been deposited then dispense the proper candy and display: Thank You!. c) If an insufficient amount (possibly zero) has been deposited then display: remaining amount needed. d) If an over amount has been deposited then dispense the proper candy and change and display: Thank You!. e) Finally, there is a special selection that will allow the customer to get a refund of all the deposited money (coin return). Thus, once the customer deposits coins and makes a selection that matches the amount deposited (or more) the candy is dispensed and he/she will retrieve the candy and change (if applicable). The VMC owner unlocks the VMC to stock the candy and the change and retrieves the profits from the money bin. Once the maintenance activities are completed, the owner will lock the VMC. Selection means that a button is selected / deselected. Given the system requirements (above) for a vending machine, describe the system using Zed.
Vending Machine Maintenance
Key extract Deposit coin(s) Key insert
Tabulate
U = Under amount C = Correct amount O = Over amount S = Select small candy M = Select medium candy L = Select large candy
Idle
Select
U S/M /L
Deselect Retrieve candy (and change)
Tabulate
Select
Star t .10 $ .10 S C
.05
$ .05 .10
Under amount
.05
Display msg: AMOUNT NEEDED IS: $XX