In this program, I'm creating 2 objects from the CarOrder class with preset values. I'm then asking the user for another 2 sets of values to create 2 more objects. Unfortunately, after entering tax status for the first one, it will skip letting the user enter a value for the buyer on the second one. Why is it randomly skipping this one question?
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
CarOrder speedy = new CarOrder("Speedy Rental", "Mini Cooper", 22150, 15, true);
CarOrder zip = new CarOrder("Zip Car Co.", "Ford Fusion", 27495, 6, true);
System.out.println("Enter Buyer: ");
String buyer1 = keyboard.nextLine();
System.out.println("Enter the type of car being purchased: ");
String car1 = keyboard.nextLine();
System.out.println("Enter the cost of this purchase: ");
double cost1 = keyboard.nextDouble();
System.out.println("Enter quantity of cars being purchased: ");
int quantity1 = keyboard.nextInt();
System.out.println("Enter tax status: ");
boolean tax1 = keyboard.nextBoolean();
System.out.println("Enter Buyer: ");
String buyer2 = keyboard.nextLine();
System.out.println("Enter the type of car being purchased: ");
String car2 = keyboard.nextLine();
System.out.println("Enter the cost of this purchase: ");
int cost2 = keyboard.nextInt();
System.out.println("Enter quantity of cars being purchased: ");
int quantity2 = keyboard.nextInt();
System.out.println("Enter tax status: ");
boolean tax2 = keyboard.nextBoolean();
CarOrder state = new CarOrder(buyer1, car1, cost1, quantity1, tax1);
CarOrder it = new CarOrder(buyer1, car2, cost2, quantity2, tax2);
System.out.println("Chicago Car Wholesalers" );
System.out.println("Oct. 30th, 2012");
System.out.println("New Car Order Report");
}
}