This is a Vending Machine that allows people to buy Products by entering the Item Code and
inserting the money required for that Item
| Item Code | Item | Cost |
|---|---|---|
| A1 | Cookie | 100 |
| A2 | iPhone Charger | 1500 |
| C5 | Potato Chips | 200 |
| D4 | Chewing Gum | 150 |
To program a VendingMachine you would need to write few methods which you will be using it In this Program I used the following methods
- ListMenu - For listing the Items and their Itemcode
- getItemPrice - For getting the price for each Items
- addMoney - For adding the money
- buy - For buying the product or item
- End - Finally press 4. to end the Program
And there are certain conditions which you need to use such as when
- If you haven't added enough money for the Item then you need to add
- And after each succesful vend you need to display "Vend Succesful"
- And if you have added more money you should return back the Balance
- If the item code isn't valid or isn't available you need to display - "Item Invalid"
Here is the Link for Running the program https://repl.it/@mohitgokul/VendingMachine