JAVA
java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import java.util.Scanner;
/* The password should contain a minimum of 10 characters, of which 8 are letters (at least 1 uppercase and 1 lowercase), and at least 1 number and 1 symbol */
public class PassStrengthChecker {
public static void main(String[] args) {
System.out.println("Enter the password: ");
String password = new Scanner(System.in).nextLine();
if(checkPass(password)) System.out.println("Password strength is Excellent");
else System.out.println("Password strength is not good enough.\nPlease try again...");
}
private static boolean checkPass(String password) {
int letter,low,upp,digit,symbol;
letter=low=upp=digit=symbol=0;
if (password.length() >= 10) { // minimum 8 letters + 1 digit + 1 symbol
for (int i = 0; i < password.length(); i++) {
char x = password.charAt(i);
if (Character.isLetter(x)) {
letter++;
}
}
} else return false;
if (letter<8) return false;
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run