I have to create an application that calculates the change a person gets when they input an amount paid and the amount owed, but not only display the change in the application, but also display the amount of dollars, quarters, dimes, nickels, and pennies the change would work out to be.

Well that's easy. Take the amount owed, multiply it by 100, and add the text " pennies"after it.

A looping solution is not what you want. quarter = 2 dimes and nickel = 2 dimes and 5 pennies = 1 dime and 3 nickels = 1 dime and 2 nickels and 5 pennies = etc. edit:

dijkstra's algorithm will give the solution with the fewest coins.

Ask Your Question

Weekly Poll