I am semi-beginner in java
This is my code
while (true) {
System.out.println("Choose the number");
System.out.println("1");
System.out.println("2");
System.out.println("3");
System.out.println("4 for Display summary and Exit");
int cho = input.nextInt();
System.out.println("Registration");
System.out.println("Enter your full name (first and lastname)");
String name = input.next();
System.out.println("Enter your National ID");
int id = input.nextInt();
System.out.println("Enter your phone number");
int phone = input.nextInt();
I made if statement for all the choices 1,2,3,4
And this is number 4 if statement
else if (cho == 4) {
System.out.println("Summary");
}
I want in this loop if user Choice 4 in the main menu prints a summary of all registered users (name, phone, id) that choices 1,2,3, even if the user made more than one register, and then exits the program.