Question: My project is to write an application that reads a monetary amount, and then determines the fewest number of each bill and coin needed to
My project is to write an application that reads a monetary amount, and then determines the fewest number of each bill and coin needed to represent that amount, starting with the highest (assuming $10 bill is the maximum size needed). Here is a sample run (When user enters 47.63, the corresponding outputs are displayed) it should all mostly be in (int)
Enter monetary amount: 47.63 That's equivalent to:
4 ten dollar bills
1 five dollar bills
2 one dollar bills
2 quarters
1 dimes
0 nickels
3 pennies
1 package projecten; 2 3 import java.util.Scanner; 7 50/" Convert a monetary amount into fewest number of each bill and coin needed * to represent that amount, starting with the highest bill $18. * @author blair "Oversion 1.0 / public class Moneycalc { 13 Converts a monetary anount into fewest number of $18, $5, $1, s.25, $.10, $8.85, $8.01 14 * @paran args A reference to a string array containing command-line arguments 15 / public static void main(String[] args){ 10 11 17 18 19 21 22 23 24 25 26 27 28 29 38 31 32 33 34 35 36 37 38 39 // 1. Read a monetary amount. // // 2. Divide the amount by $le to calculate the number of Sie. // 3. Calculate the remaining amount. // 4.Divide the remaining amount by the remaining amount of $5 to calculate the number $5. // 5. Calculate the remaining amount. // 6. Divide the remaining amount by the remaining amount of $1 to calculate the number $1. 1/ 7. Calculate the remaining amount. // 8.Divide the remaining amount by the remaining amount of $9.25 to calculate the number $8.25. // 9.Calculate the remaining amount. // 18.Divide the remaining amount by the remaining amount of Se.10 to calculate the number se.1e. 1/ 11. Calculate the remaining amount. // 12. Divide the remaining amount by the emaining of $e.e5 to calculate the number se.as. // 13.Calculate the remaining amount. // 14. The number of $9.81 is equal to the remaining amount. // // 15.Display the number of $10. // 16.Display the number of $5. // 17.Display the number of $1. // 18.Display the number of $2.25. // 19.Display the number of $0.10. // 28.Display the number of $8.05. 1/ 21. Display the number of se.01. 41 42 343 45 46 847 48 49} 50
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
