Results 1 to 2 of 2
  1. #1
    PinkFly is offline Member
    Join Date
    Mar 2012
    Posts
    1
    Rep Power
    0

    Default 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");
    }


    }


    }

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,562
    Rep Power
    25

    Default Re: Need Help! Please!

    Count the number of incorrect guesses and when the count reaches the limit, print out the message.
    If you don't understand my response, don't ignore it, ask a question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •