In my program I need to have the user get two chances before ending the program. Currently if the condition is not satisfied then they only get one try. I would like some help in getting a second try.
// Takes user entry
Scanner user = new Scanner(System.in);
System.out.println("Please enter your first name:"); // Enter first
String first = user.next();
System.out.println("Please enter your last name:"); // Enter last
String last = user.next();
// Create new object
ShareHolder out = new ShareHolder(first,last);
System.out.println(out.getFirstName()+" "+out.getLastName());
String str = "";
str = out.getFirstName()+" "+out.getLastName();
boolean found = false;
for (int i = 0; i < names.length; i++)
if (str.equalsIgnoreCase(names[i])) {
found = true;
break;
}
if (found) {
System.out.println("You may participate in the meeting!");
}
else {
System.out.println("Sorry name not found, please try again!");
// Need help here!!!!
System.out.println("After second attempt your name is not on the list!");
}
}
}