public class Money{
public static void main(String args[]){
//Create Scanner
Scanner input = new Scanner(System.in);
System.out.println("Enter an amount in double, for example:23.67");
double amount = input.nextDouble();
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 numberOfPennies = remainingAmount;
System.out.println(" Your amount " + amount + " consists of " + numberOfOneDollars + " dollars " + numberOfQuarters + " quarters " + numberOfDimes + " dimes " + numberOfNickels + " nickels " + numberOfPennies + " pennies " );
}
}
public static void main(String args[]){
//Create Scanner
Scanner input = new Scanner(System.in);
System.out.println("Enter an amount in double, for example:23.67");
double amount = input.nextDouble();
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 numberOfPennies = remainingAmount;
System.out.println(" Your amount " + amount + " consists of " + numberOfOneDollars + " dollars " + numberOfQuarters + " quarters " + numberOfDimes + " dimes " + numberOfNickels + " nickels " + numberOfPennies + " pennies " );
}
}