Take a value and manually reduce it to the change values. Start at the big valued coins and move down to pennies. If you have 57 then 57/10 = 5 and 57&10 = 7 7/5 = 1 & 7%5 = 2
As you do the...
Type: Posts; User: Norm
Take a value and manually reduce it to the change values. Start at the big valued coins and move down to pennies. If you have 57 then 57/10 = 5 and 57&10 = 7 7/5 = 1 & 7%5 = 2
As you do the...
nickles = (nickles - 1)
quarters = (quarters + 1)
// can be shortened to:
nickles--; // subtract one
quarters++; // add one
You need to spend more time on designing how the code should...
casting a double to an int will drop the fractional parts.
When working with money, look at using pennies instead dollars with 2 decimal points.
This will require scaling dollars to pennies by...
Look at using the /, % and - operators to solve this.