Create a Change application that prompts the user for an amount less than $1.00 and then displays the minimum number of coins necessary to make the change.
The change can be made up of quarters, dimes, nickels, and pennies.
Here is what I did:
public static void main(String[] args) {
System.out.println("Enter the amount in cents: ");
int a = in.nextInt();
if(a <= 100){
}else{
System.out.println("Try Again");
System.exit(0);
}
{
int q = (a/25);
int d = (a/25);
System.out.println("Quarters: " + q);
System.out.println("Dimes: " + d);
}
}
}
D is irrelevant. because I don't know how to get the remainder of quarters and divide it by 10 and so on all the way through pennies