CS 117: Introduction to Computer Science
Assignment: Change Maker

Create a class named ChangeMaker with a method called makeChange that takes two parameters: purchasePrice, and amountTendered. The method should then display the change in dollars, quarters, dimes, nickels, and pennies. Display the output in the following format:



 Purchase Price:   $34.5
Amount Tendered:   $40.

 Your change is:   $5.5

                   5 one-dollar bill(s)
                   2 quarter(s)

Thank you for your business. Come back soon.


Your answer should be the natural one, i.e. the one that gives away as little small change as possible. You may assume that both the purchase price and the amount tendered are less than $100, and greater or equal to $0. You may also assume that the amount tendered is greater than or equal to the purchase price. Your output might be ugly due to some rounding problems, i.e. you may see numbers like 3.0000000001 or something. This is acceptable.

Good luck!

Additional things you might try, if you want to push further ahead on your own:

Look through your textbook and figure out how to use Format.rightAlign to make the output nicer.
Use an "if" statement to output something appropriate if the amountTendered is less than the purchasePrice.