June 18th, 2013, 04:46 AM
Need help with a homework problem
Having trouble with this one...
Write a Java program that will distribute the total amount of money found in a piggy bank into the following currencies: half dollars, quarters, dimes, nickels and pennies. The distribution will begin with the largest currency and move downward to the smallest. The process will follow these steps:
1.) The program is to prompt the user for the currency found in the bank;
2a.) find the largest equivalent number of half dollars present in the total amount;
2b.) reduce the total amount of money by the value of the half dollar amount; proceed by repeated the above process (steps 2a and 2b, using the new remaining dollar amount) to find the largest equivalent number of quarters, then dimes, then nickels, and finally, the remaining pennies
3.) the program will then display the equivalent number of half dollars, quarters, then dimes, then nickels, and finally, the remaining pennies.
Please enter the total dollar amount in the piggy bank: $16.72
In $16.72 there are:
33 half dollar(s), 0 quarter(s), 2 dime(s), 0 nickel(s), and 2 cent(s).
The output must be exactly the same as that
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.