Report as inappropriate.
"Write a program to simulate a cash register change calculator. Allow the user to
enter a purchase price of up to 100 dollars. Then determine the best change to
give back for a $100 bill. Print the results to the screen as below, with no zero
results displayed. Note: ignore the existence of half-dollars, $2 bills and $50 bills.
Assume that the purchase price is a whole amount. "
This was kind of annoying to make. But I am proud of it. You should be too.
I used Ninto's bitfont class.
CONTROLS:
Click "TENDERED" and enter the amount of money you're "paying". Backspace to clear.
Click "ITEM PRICE" and enter the price of the item you're "paying for". Backspace to clear.
Click the "CHANGE:" block to calculate the best change combination of $1, $5, $10, and $20.
UPDATE: Fixed it so numbers higher than 100 can't be entered. (see rules ^ )
UPDATE: Made the default "tendered" $100. Can still be changed to any number <= 100, but the instructions say the person is paying with $100.
UPDATE: Fixed it so it resets the "results" arraylist when you click to calculate the change combination... before it would just add the number of bills from the new calculation to the results from the last one and display the sums.... doh
...and finally commented.
Want to leave a comment? You must first log in.
No votes yet.
2010/6/28