i have to write a program that will display the purchase,tender ed,change,dolla rs,Q,D,N,P
the purchase & tendered has to be double and the number of coins have to be an int when i run the prgm it only asks me to enter purchase and tendered amount and thats it. it does not ask anything else it like skips everything else..anybody has an advice on how i can improve it pleaseee and thank u..
[CODE=Java]import java.util.Scann er;
public class Program2
{
public static void main(String[] args)
{
double purchase, tendered;
int change, dollars, quarters, dimes, nickels, pennies;
Scanner keyboard=new Scanner(System. in);
System.out.prin tln("Enter amount of purchase: ");
purchase=keyboa rd.nextDouble() ;
System.out.prin tln("Enter amount tendered: ");
change = tendered - purchase;
dollars = (int) (change / 100);
System.out.prin tln("Your change is: " + change);
System.out.prin tln("The number of dollars is: " + dollars);
System.out.prin tln("The number of quarters is: "+ quarters);
System.out.prin tln("The number of dimes is: " + dimes);
System.out.prin tln("The number of nickels is: " + nickels);
System.out.prin tln("The number of pennies is: " + pennies);
}
}[/CODE]
the purchase & tendered has to be double and the number of coins have to be an int when i run the prgm it only asks me to enter purchase and tendered amount and thats it. it does not ask anything else it like skips everything else..anybody has an advice on how i can improve it pleaseee and thank u..
[CODE=Java]import java.util.Scann er;
public class Program2
{
public static void main(String[] args)
{
double purchase, tendered;
int change, dollars, quarters, dimes, nickels, pennies;
Scanner keyboard=new Scanner(System. in);
System.out.prin tln("Enter amount of purchase: ");
purchase=keyboa rd.nextDouble() ;
System.out.prin tln("Enter amount tendered: ");
change = tendered - purchase;
dollars = (int) (change / 100);
System.out.prin tln("Your change is: " + change);
System.out.prin tln("The number of dollars is: " + dollars);
System.out.prin tln("The number of quarters is: "+ quarters);
System.out.prin tln("The number of dimes is: " + dimes);
System.out.prin tln("The number of nickels is: " + nickels);
System.out.prin tln("The number of pennies is: " + pennies);
}
}[/CODE]
Comment