Sunday, August 14, 2011

A customer brings purchases worth less than $20 to the till, and hands over a $20 bill.?

A customer brings purchases worth less than $20 to the till, and hands over a $20 bill. Write pseudocode for an algorithm to figure out what change the customer should receive -- i.e., how many $10 bills, how many $5 bills, how many toonies ($2), loonies ($1), quarters (0.25), dimes (0.10), nickels (0.05), and pennies (0.01). Begin by listing the variables you will need. Keep in mind that a proper solution will use as few coins as possible!

No comments:

Post a Comment