import javax.swing.JOptionPane;
public class book2_7 {
public static void main(String []
args){
String amountString = JOptionPane.showInputDialog(
"Enter an amount in double,for example 123.15");
double amount = Double.parseDouble(amountString);
int remainingAmount=(int)(amount*100);
int numberOfOneDollars = remainingAmount/100;
remainingAmount=remainingAmount%100;
int numberOfQuarters=remainingAmount/25;
remainingAmount=remainingAmount%25;
int numberOfDimes= remainingAmount/10;
remainingAmount=remainingAmount%10;
int numberOfNickels=remainingAmount/5;
remainingAmount=remainingAmount%5;
int numberOfPannies=remainingAmount;
String output="Your amount "+amount+" consists of \n"
+numberOfOneDollars+" dollars\n"+numberOfQuarters+
" quarters\n"+numberOfDimes+" dimes\n"+numberOfNickels+
" nickels\n"+numberOfPannies+" pannies\n";
JOptionPane.showMessageDialog(null,output);
}
}