- For position = 1 to N do
- Find the location of the smallest item (position to N)
- Swap it with the item at location position
Give Change
- Get Price
- Get Amount Paid
- Change = Amount Paid - Price
- Give change
- Get Price
- Get Amount Paid
- Change = Amount Paid - Price
- While the change is not correct
- Grab a random selection of coins, make this the change
- Give Change
- Get Price
- Get Amount Paid
- Change = Amount Paid - Price
- For each coin type
- While Change > coin value
- add one coin of this type
- subtract the coin value from Change
- Give Change
- Get Price
- Get Amount Paid
- Change = Amount Paid - Price
- For each coin type largest to smallest
- While Change > coin value
- add one coin of this type
- subtract the coin value from Change
- Give Change