There is a special cash machine, without any security, that dispenses money (notes and coins). The machine has a given initial state of what coins and notes it has available. The initial state is: 100x1p, 100x2p, 100x5p, 100x10p, 100x20p, 100x50p, 100x£1, 100x£2, 50x£5, 50x£10, 50x£20, 50x£50. You should create a program that is given the value to withdraw as an input. Program the cash machine, so it has 2 algorithms that can be swapped (swapping can be done by rebuilding and rerunning the application):
- Algorithm that returns least number of items (coins or notes)
- Algorithm that returns the highest number of £20 notes possible Output the number of coins and notes given for each withdrawal. The machine should output the count and value of coins and notes dispensed and the balance amount left. The program should be extendible and written using .NET framework. Use the best approach you can to implement the solution. Examples
- Input (Withdrawal amount)
- 120.00
- Output
- £50x2, £20x1
- £X.XX balance
- Input
- 120.00
- Output
- £20x6
- £X.XX balance