I made a program that answers individual questions and I would like it to end after asking 3 questions in any order. I only did that when I write Bye, the program will end and I don't know how to turn it into these 3 questions. I would like the answer to this question to be related to this code, please
import java.util.Scanner;
class Bot {
public static void main(String[] args) {
System.out.println("QUESTIONS: How old are you? | What is your name? | What did you eat for breakfast?");
System.out.println("Ask a question?");
Scanner pytania = new Scanner(System.in);
String input;
boolean running = true;
while (running) {
System.out.println(" ");
input = pytania.nextLine();
if (input.equals("How old are you?")) {
System.out.println("I am 125 years old");
} else if (input.equals("Bye")) {
System.out.println("Bye!");
running = false;
} else if (input.equals("What is your name?")) {
System.out.println("My name is Christopher");
} else if (input.equals("What did you eat for breakfast?")) {
System.out.println("I had scrambled eggs for breakfast");
} else {
System.out.println("Sorry, I don't understand the question!");
}
}
}
}