ADDITIONAL SYSTEM INFORMATION :
Line 11 is not stop to get the customerName
If I move 3 lines as below
System.out.print("Again the cusomer name is " );
customerName = input.nextLine();
System.out.println("The cusomer's name is " + customerName);
It will wait for input customerName the 2nd time
import java.util.Scanner;
public class SalesTax {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("\n\n");
System.out.print("The cusomer name is " );
String customerName = input.nextLine();
System.out.println("The cusomer's name is " + customerName);
System.out.print("Again the cusomer name is " );
customerName = input.nextLine();
System.out.println("The cusomer's name is " + customerName);
System.out.print("Enter purchase amount : ");
double purchaseAmount = input.nextDouble();
double tax = purchaseAmount * 0.10;
System.out.println("Sales tax is $" + (int)(tax*100)/100.0);
System.out.print("Again Purchase amoutn : ");
purchaseAmount = input.nextDouble();
System.out.println("Sales tax is $" + (int)(tax*100)/100.0);
System.out.print("Again the cusomer name is " );
customerName = input.nextLine();
System.out.println("The cusomer's name is " + customerName);
}
}
A DESCRIPTION OF THE PROBLEM :
import java.util.Scanner;
public class SalesTax {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("\n\n");
System.out.print("The cusomer name is " );
String customerName = input.nextLine();
System.out.println("The cusomer's name is " + customerName);
System.out.print("Enter purchase amount : ");
double purchaseAmount = input.nextDouble();
double tax = purchaseAmount * 0.10;
System.out.println("Sales tax is $" + (int)(tax*100)/100.0);
System.out.print("Again Purchase amoutn : ");
purchaseAmount = input.nextDouble();
System.out.println("Sales tax is $" + (int)(tax*100)/100.0);
System.out.print("Again the cusomer name is " );
customerName = input.nextLine();
System.out.println("The cusomer's name is " + customerName);
}
}
FREQUENCY : often
Line 11 is not stop to get the customerName
If I move 3 lines as below
System.out.print("Again the cusomer name is " );
customerName = input.nextLine();
System.out.println("The cusomer's name is " + customerName);
It will wait for input customerName the 2nd time
import java.util.Scanner;
public class SalesTax {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("\n\n");
System.out.print("The cusomer name is " );
String customerName = input.nextLine();
System.out.println("The cusomer's name is " + customerName);
System.out.print("Again the cusomer name is " );
customerName = input.nextLine();
System.out.println("The cusomer's name is " + customerName);
System.out.print("Enter purchase amount : ");
double purchaseAmount = input.nextDouble();
double tax = purchaseAmount * 0.10;
System.out.println("Sales tax is $" + (int)(tax*100)/100.0);
System.out.print("Again Purchase amoutn : ");
purchaseAmount = input.nextDouble();
System.out.println("Sales tax is $" + (int)(tax*100)/100.0);
System.out.print("Again the cusomer name is " );
customerName = input.nextLine();
System.out.println("The cusomer's name is " + customerName);
}
}
A DESCRIPTION OF THE PROBLEM :
import java.util.Scanner;
public class SalesTax {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("\n\n");
System.out.print("The cusomer name is " );
String customerName = input.nextLine();
System.out.println("The cusomer's name is " + customerName);
System.out.print("Enter purchase amount : ");
double purchaseAmount = input.nextDouble();
double tax = purchaseAmount * 0.10;
System.out.println("Sales tax is $" + (int)(tax*100)/100.0);
System.out.print("Again Purchase amoutn : ");
purchaseAmount = input.nextDouble();
System.out.println("Sales tax is $" + (int)(tax*100)/100.0);
System.out.print("Again the cusomer name is " );
customerName = input.nextLine();
System.out.println("The cusomer's name is " + customerName);
}
}
FREQUENCY : often