Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- public class test {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- StringBuilder builder1 = new StringBuilder();
- String name = input.nextLine();
- String pass;
- boolean found = false;
- builder1.append(name);
- builder1.reverse();
- int counter=0;
- do{
- pass = input.nextLine();
- counter++;
- if(counter==4 && pass.contentEquals(builder1)){
- break;
- }
- else if(counter==4){
- found=true;
- break;
- }
- if(!(pass.contentEquals(builder1))){
- System.out.println("Incorrect password. Try again.");
- }
- }
- while(!(pass.contentEquals(builder1)));
- if(found){
- System.out.printf("User %s blocked!",name);
- }else{
- System.out.printf("User %s logged in.",name);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement