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
/*Write a program that takes in a string as input and evaluates it as a valid password. The password is valid if it has at a minimum 2 numbers, 2 of the following special characters ('!', '@', '#', '$', '%', '&', '*'), and a length of at least 7 characters.
If the password passes the check, output 'Strong', else output 'Weak'.
*/
import java.util.Scanner;
public class Program{
public static void main(String[] args) {
Scanner obj = new Scanner(System.in);
String password = obj.nextLine();
numbercheck obj1 = new numbercheck();
int number = obj1.numbercheck(password);
charcheck obj2 = new charcheck();
int charnum = obj2.charcheck(password);
if(number>=2&&charnum>=2&&password.length()>=7)
System.out.println("Strong");
else
System.out.println("Weak");
obj.close();
}
}
class numbercheck {
public int numbercheck(String password) {
int a = 0;
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run