0

I created a function that lets the user input information about a flight, but after the code outputs "Please enter the destination of the flight", the function finishes and you cannot enter your answer as eclipse has moved on to the part of the code where I called the function

if(options.contentEquals("a")) {
            addFlight();
        }else if(options.contentEquals("b")) {
            removeFlight();
        }else if(options.contentEquals("c")) {
            showManifest();
        }else {
            flag = true;
        }
    }while(flag == false);
        

}
public static void addFlight() {
    System.out.println("Please enter the flightID");
    int flightID = kb.nextInt();
    System.out.println("Please enter the origin of the flight");
    String origin = kbint.nextLine();
    System.out.println("Please enter the destination of the flight");
    String destination = kb.nextLine();
    flight Flight = new flight(flightID,origin,destination);
    flights.add(Flight);
}

I am wondering if I can put a line of code which waits for a response, then moves on to the next instruction.

(Please excuse my beginner coding lingo and bad syntax

JPxl05
  • 1

0 Answers0