I cant seem to get this right im tring to find the optimal solution and the user imput is 219 how do i get the user to imput a number and what is wrong with my coding am i atleast close HELP
[CODE=java]public class Makechange
{
public static void main (String []args)
{
}
{
System.out.prin tln (" Please Enter number:" );
int dollars = amount / 100;
//number of dollars
int dollarValue = dollars % 100;
// value of quarters
int amount;
amount = dollarsValue;
int quarters = amount / 25;
//number of quarters
int quartersValue = quarters % 25;
//value of quarters
amount -= quartersValue;
int dimes = amount / 10;
//number of dimes
int dimesValue = dimes % 10;
// The value of the dimes
amount -= dimesValue;
int nickels = amount / 5;
//number of nickels
int nickelsValue = nickels % 5;
//value of nickels
amount -= nickelsValue;
int pennies = amount/ 1;
//number of pennies
int penniesValue = pennies % 1;
//value of pennies
amount -= penniesValue;
System.out.prin tln ("Dollars: " + dollars);
System.out.prin tln ("Quarters: " + quarters);
System.out.prin tln ("Dimes: " + dimes);
System.out.prin tln ("Nickels: " + nickels);
System.out.prin tln ("Pennies: " + pennies);
}
}[/CODE]
[CODE=java]public class Makechange
{
public static void main (String []args)
{
}
{
System.out.prin tln (" Please Enter number:" );
int dollars = amount / 100;
//number of dollars
int dollarValue = dollars % 100;
// value of quarters
int amount;
amount = dollarsValue;
int quarters = amount / 25;
//number of quarters
int quartersValue = quarters % 25;
//value of quarters
amount -= quartersValue;
int dimes = amount / 10;
//number of dimes
int dimesValue = dimes % 10;
// The value of the dimes
amount -= dimesValue;
int nickels = amount / 5;
//number of nickels
int nickelsValue = nickels % 5;
//value of nickels
amount -= nickelsValue;
int pennies = amount/ 1;
//number of pennies
int penniesValue = pennies % 1;
//value of pennies
amount -= penniesValue;
System.out.prin tln ("Dollars: " + dollars);
System.out.prin tln ("Quarters: " + quarters);
System.out.prin tln ("Dimes: " + dimes);
System.out.prin tln ("Nickels: " + nickels);
System.out.prin tln ("Pennies: " + pennies);
}
}[/CODE]
Comment