-
Need Help! Please!
So I need to create a password application where the user enters a password and a message comes up whether it is correct or incorrect. I did most of it, but I need help on how to add a message where after three incorrect guesses, the message "Access Denied" comes up. How would I do that?
Here is what I have:
import java.util.Scanner;
public class Password {
public static void main(String args[]) {
Scanner input = new Scanner(System.in);
String password;
System.out.println("Enter the password:");
password = input.nextLine();
if(password.equals("Computer Science")){
System.out.println("The password is correct");
}
else{
System.out.println("The password is incorrect");
}
}
}
-
Re: Need Help! Please!
Count the number of incorrect guesses and when the count reaches the limit, print out the message.