CSC 7000 - Algorithms and Programming

Project #2

Due 9am Wednesday, January 30, 2002

Design and implement a Java application that makes change for $1. Specifically, the program should read an integer value between 0 and 100 (inclusive), representing the amount of a purchase in cents. Produce an error message if the input value is not in that range. If the input is valid, determine the amount of change that would be received from one dollar, and print the total change plus the number of quarters, dimes, nickels, and pennies that should be returned.

Maximize the number of coins with the highest value. For instance, don't return two nickels when you can return 1 dime. Produce output similar to the format below:

 
Enter the purchase amount [0-100]: 36
Your change of 64 cents is given as:
   2 Quarters
   1 Dime
   0 Nickels
   4 Pennies

Print the singular of the coin if the quantity returned is 1. That is, print

   1 Penny

instead of

   1 Pennies
 

Carefully design your algorithm prior to implementing your solution. Use the division (/) and remainder (%) operators carefully to simplify your approach.

Your program must be well documented and formatted.

Name your source code file Change.java and please follow the instructions for submitting a project.