Skip to content

Instantly share code, notes, and snippets.

@trmsmy
Created April 2, 2020 18:06
Show Gist options
  • Save trmsmy/044b07bddd48581de1e84a23b937ad34 to your computer and use it in GitHub Desktop.
Save trmsmy/044b07bddd48581de1e84a23b937ad34 to your computer and use it in GitHub Desktop.
vending machine
Design A Vending Machine
A vending machine has Products (snacks) stacked in "Product Slots". Each "Product Slot" has an ID which is TWO DIGIT number, a PRICE.
Vending machine has a "coin slot", which can take NICKLE, DIME or QUATER only.
Vending machine has a keypad has follwing keys
* KEY 0 to 9 to pick Product Slot ID
* CLEAR is to clear your selection
* ENTER key is used to confirm your Product selection if credit is available
* DONE key is return any balance or deposited coins
A user can start a transaction by adding coins or by typing the "Product Slot" ID and pressing ENTER.
If there is a sufficient credit, dispense the Product, in case of insufficient credit, show the "Product" price. So, the user can drop coins for their selections. Upon ENTER, dispense the product if credit is available.
Product/Snack -- can have a name for 'toString' purpose.
There is no UI or GUI for this project. The input can be taken using System.io. All outputs can be written to Console.
Vending machine should expose admin operations
* Update inventory - load one or many Products (quantity) and Product Slot ID
* Update pricing - Set new price on any Product Slot ID
Vending machine should return current state (reporting):
* Inventory report - Print all "Product Slot" with no. of available product
* Sale report - Print sales - No. of Sales per Product and Money, and Total Sales.
* Discuss the problem
* provide logical presentation of the actors/model.
* create a skeleton project with these actors as classes/interfaces and their interactions
* Implement user's interaction and reporting functionality as priority (if time permits, admin functionality can be tackled)
https://www.vending.com/wp-content/uploads/2019/09/AB42-296-DS-5WSZ-Silver-Combo-lftqtr.png
https://miro.medium.com/max/4392/1*6daVASIQ_gt916KRq2fWTA.jpeg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment