Create a vending machine in code
Scenarios:
-
Vending machine when inserting money said money should be accepted.
-
When inserting money and then pressing "Reject" then it should return the same money that was inserted.
-
When inserting correct money and selecting a product the product should be dispensed and no change given.
-
When inserting £2 and selecting product priced at £1.50 then product should be dispensed and change of 50p returned.
-
When inserting £5 and selecting producy priced at £1.73 then product should be dispensed and correct change returned.
-
When inserting £1.75 and selecting product B7 the user should be informed that no product is available and should be able to select product B6 instead and product dispensed.
-
Change in the machine is made up: 10 x 5p 2 x 20p 2 x £1 7 x 1p 1 x 2p When 2 x £2 is inserted and product priced at £1.72 is selected and product priced at £0.59 is selected then products are dispensed and the correct change is returned using change available
-
Stock contains 1 item left at position F4 priced at £1 each when £2 is inserted and product F4 is selected and then selected again and then rejected then single item at F4 should be dispensed and second selected product should be display "no available product" to the user and change should be returned.
-
Machine has been filled with stock and has been in use throughout the day when an engineer opens up the back of the vending machine and selects "show stock used" report then the engineer should be shown what products had been dispatched at each location.
-
Machinehas been in use throughtout the day dispensing products and tracking change given when an engineer opens up the back of the back of the machine and selects a "show money taken" report then the engineer should be shown a count of what money the machine now contains by money type (eg 5 x 10p)
-
When stock levels of a single item reduces to 2 remaining items then the vending machine should dial to head office to inform them of low stock.