Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // LOG-IN
- System.out.println("Enter Username");
- String loginusername = input.nextLine();
- System.out.println("Enter Password");
- String loginpassword = input.nextLine();
- int attempt = 3;
- while ((!loginusername.equals(username)) || (!loginpassword.equals(password))) {
- attempt--;
- System.out.println("You pressed wrong password and/or username, you have " + attempt + " attempts left");
- if (attempt == 0)
- System.out.println("Sorry you have exceeded the number of tries. Please try again after few hours" );
- else
- System.out.println("Enter Username");
- loginusername = input.next();
- System.out.println("Enter Password");
- loginpassword = input.next();
- }
- if ((loginusername.equals(username)) && (loginpassword.equals(password))) {
- System.out.println("You are now logged in...");
- System.exit(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement