Hey guys,
Basically I'm making a simulation of a ticket machine and I'm having trouble on the logic on how it should give change. So for example if the user puts say 50p but the ticket is 40p then 10p change will be given. In the case however the returned change is not a whole coin value and a composition of various coins then any ideas on how I should do this? Also the coins are taken from a container class which holds each coin value if a container is emtpy can it be skipped during the process, any ideas here?
I thought maybe there could be a way of working it out mathematically but I'm not too sure. Thanks in advance guys.
Basically I'm making a simulation of a ticket machine and I'm having trouble on the logic on how it should give change. So for example if the user puts say 50p but the ticket is 40p then 10p change will be given. In the case however the returned change is not a whole coin value and a composition of various coins then any ideas on how I should do this? Also the coins are taken from a container class which holds each coin value if a container is emtpy can it be skipped during the process, any ideas here?
I thought maybe there could be a way of working it out mathematically but I'm not too sure. Thanks in advance guys.