Programming Assignment # 1

Due: September 30.

In this assignment you will write an interactive program that acts like a cash register. The cash register of the future tells you not only how much change to give, but how to give it (e.g. how many quarters, how many nickels, etc.).

Your program should run as an application. First, your program asks for and receives input for the amount of a purchase. For this assignment, you can assume the maximum amount of any purchase is $10.00, and the maximum cash tendered that you have to make change for is also $10.00. Your program should make change using as few bills and coins as possible, using the algorithm discussed in class.

Once you have the basic program working you should add error checking. For example, if the cash tendered is less than the purchase price, print a message and handle the situation appropriately. Try to catch other errors as well. (Your program will be tested using a variety of suspect inputs!)

Because of the difficulties of handling floating point numbers, your program should work with integer variables. For example, $1.23 can be treated as 123 cents. A simple way to do this is to enter the dollars and cents separately as integers (so there are double the number of inputs mentioned above), instead of one floating point input.