Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Shavit Borisov
- // CW
- import java.util.Scanner;
- public class Password {
- public static void main(String[] args)
- {
- Scanner in = new Scanner (System.in);
- char ch;
- int uppercaseCounter = 0;
- int lowercaseCounter = 0;
- int chCounter = 0;
- System.out.println("Enter your password. End it with the symbol *");
- ch = in.next().charAt(0);
- do
- {
- if(ch >= 65 && ch <= 90)
- uppercaseCounter++;
- else if(ch >= 97 && ch <= 122)
- lowercaseCounter++;
- chCounter++;
- ch = in.next().charAt(0);
- }
- while(ch != '*');
- if(uppercaseCounter > 0 && lowercaseCounter > 0 && chCounter > 5)
- System.out.println("Your password is ok!");
- else
- System.out.println("Your password is not ok!");
- in.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement