Change maker

This assignment will get you thinking about algorithms.

Write a change-making algorithm for a clerk at a 99-cent store (or a vending machine). The customer pays for an item that costs no more than 99 cents with a dollar bill. Your algorithm should make change for the dollar, giving the number of quarters, dimes, nickles and pennies that will minimize the number of coins returned.

Do not attempt to program the algorithm in VB. Do not even think about VB or Geek while you do it. Work in English and use common sense. Think of it as writing a list of instructions for a person. not a computer.

Hint: A good way to begin is by working through a couple of examples by hand and paying attention to the way you are solving the problem.

Could you generalize your algorithm by extending it to make change for any amount up to $100 using bills?

Could you generalize it further by allowing it to work with in different nations with different currency denominations? For example, in Japan, currency comes in 1, 5, 10, 50, 100 and 500 yen coins and 1,000, 5,000 and 10,000 yen bills.


Disclaimer: The views and opinions expressed on unofficial pages of California State University, Dominguez Hills faculty, staff or students are strictly those of the page authors. The content of these pages has not been reviewed or approved by California State University, Dominguez Hills.