So I need to make a Java program to get the exact change from a specific dollar
ID: 3620323 • Letter: S
Question
So I need to make a Java program to get the exact change from a specific dollar amount inputed by the user.Here is an example:
$4.23 is 3 cents,
0 nickels, 2 dimes,
0 quarters, 4 dollars,
0 fives, 0 tens,
0 twenties, 0 fifties,
and 0 hundreds.
I know how to start the code but I'm just not sure about the math behind it. For instance I know first, to convert it to cents by multiplying by 100, and you can get the number of 100's by dividing by 10000, but then when it gets to 50's that theory fails.
Any help is appreciated.
Thanks