Challenge: Change Machine
Write a class that simulates the functionality of a change machine.
- A Constructor that accepts a list of coins.
So you can setup the initial state of the machine. What denominations it accepts and initial quantities. etc.
- A way to set the Unit Price.
Edit: Unit Price -> The amount you have to pay, before goods are dispensed and change issued.
- A way of inserting coins
- A way to return the coins the user has inserted for the current transaction.
- A way to dispense the change (once the unit price is met), made from the available coins in the machine.
Excluding those the user has insert for the current transaction. After the transaction is completer those coins are available to be used for change.
- Raise Events to reflect the internal state changes.
Submissions (preferably vb.net) must follow the traditional challenge standing orders.
This post has been edited by AdamSpeight2008: 02 October 2012 - 08:58 AM