Vending Machine coding challenge
Clone this repo, and from its root dir:
$ ruby cli.rb
Provide the functional design of software that controls a Vending Machine. The Vending Machine has a predefined set of items that the user can purchase using cash. The vending machine has the following actions:
- User inserts cash
- User selects item
- Item is dispensed if enough money has been inserted
- Change is dispensed
- Coin denominations accepted:
- Quarter = 25 cents
- Dime = 10 cents
- Nickel = 5 cents
- Penny = 1 cent
The first two actions shoud be allowed in any imaginable order, for example:
- User may select item first, then insert enough coins to dispense it.
- User may insert enough coins, then select an item.
- ๐ And any combinations of these 2 actions.
- If they select a different item after they've already inserted some coins, the "Sale Price" should change to that item. They should be required to insert that much money. They can select a different item as many times as they want.
- Write a program that emmulates the Vending Machine.
- Choose whatever input method you prefer. CLI is fine, or simulated input from a Test.
- Implement a method
dispense_change()