For some reason, my code will not accept input on the last line "What would you like to order: "
Could anyone tell me what my error is here? It is compiling correctly and everything. I am only a beginner so please tell me in basic terms.
import java.util.Scanner;
import java.util.*;
class RestaurantMain {
public static void main(String[] args)
{
//Create an array list
ArrayList menu = new ArrayList();
//Variables//
int choice;
int customerChoice;
boolean trueFalse;
int restart = 0;
String choice2;
String addItems = "";
int menuCount = 0;
int indexCount = 0;
String item = "";
//Import input device
Scanner in = new Scanner(System.in);
ArrayList theMenu = new ArrayList();
System.out.println("Welcome to the Cooper's restaurant system!");
System.out.println("How can I help?");
System.out.println("");
System.out.println("1. Customer System");
System.out.println("2. Management System");
System.out.println("");
System.out.println("");
System.out.print("Which option do you choose: ");
choice = in.nextInt();
if (choice == 1) {
System.out.println("Our menu's are as follows:");
System.out.println("");
System.out.println("1. Drinks");
System.out.println("2. Starters");
System.out.println("3. Mains");
System.out.println("4. Desserts");
System.out.println("");
System.out.println("Please note - You MUST order 5 items.");
System.out.println("");
System.out.print("What menu would you like to follow? ");
customerChoice = in.nextInt();
if (customerChoice == 1) {
System.out.println("Drinks Menu");
System.out.println("Would you like to order? ");
choice2 = in.nextLine();
if (choice2 == "yes") {
System.out.println("Please enter the amount of items you want to order: ");
while (indexCount <= menuCount);
System.out.println("Please enter your item: ");
item = in.nextLine(); {
theMenu.add(item);
}
}
}
if (customerChoice == 2) {
System.out.println("Starters Menu");
}
if (customerChoice == 3) {
System.out.println("Mains menu");
}
if (customerChoice == 4) {
System.out.println("Desserts Menu");
}