0

Hi, I'm brand new to the forum and am taking an intro to Java class and need tome help. I have never programmed before so go easy on me, lol.

The problem is to get the exact change from a dollar amount that a user inputs.

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.

What I am most confused about is the math behind it all. I converted the dollar amount into cents but them I'm not exaclty sure how to get all the dollar denominations. I know its something with dividing and carrying remainders but thats about it.

Here is what I have so far.

```
import java.util.Scanner;
public class Assg1
{
public static void main (String[]arg)
{
Scanner kbd = new Scanner(System.in);
double amntMoney;
System.out.print("Enter amount of money.\n "
+ "Include cents.\n"
+ "$ ");
amntMoney = kbd.nextDouble();
double cents = amntMoney*100;
}
}
```

Thanks for any help.