Initially the vending machine has 0 quarter
, 0 dime
and 0 nickle
but you can manually change the value in Model.swift
file
struct Model {
...
private(set) var numberOfQuarter: Int = 0
private(set) var numberOfDime: Int = 0
private(set) var numberOfNickle: Int = 0
...
}
- Insert coin
- Select a product (if not enough coin then repeat step 1 or return changes)
- Return changes to customers (vending machine might or might not have the appropriate changes. If it does not have the appropriate changes. Return changes to yourself and repeat step one)
More on how vending machine works.