PLEASE HELP ME FIX THE PROBLEM
import java.util.Scanner; //import scanner input
class Main {
public static void main(String[] args) {
//Input number of password to
make
Scanner scan = new
Scanner(System.in);
System.out.println("Number of random
password to make:");
//Input the length of password
int number = scan.nextInt();
System.out.println("The length of the
character to make:");
int length = scan.nextInt();
String[] randomPassword = new
String[number];
//loop
for(int i = 0; i < number; i++)
{
//Generate one
random password
for(int i = 0; i
< length; i++) {
randomPassword += randomCharacter();
}
//Add to array of
password
randomPassword =
randomPassword;
}
printPassword(randomPassword); //print
array of password
System.out.println(getStrength(length)); //print password
strength
}
public static String getStrength(int length) {
//Conditional for the password
strength
if (length < 6) {
return
"short";
} else if (length < 12) {
return
"medium";
} else {
return
"strong";
}
}
public static void printPassword(String[] arr)
{
for(int i = 0; i < arr.length;
i++) {
System.out.println(arr);
}
}
public static char
randomCharacter() {
int x =
(int)(Math.random()*50);
// Conditional of the
length to make
if (x<=8) {
int a
= x + 48;
return
(char)(a);
} else {
int a
= x + 65;
return
(char)(a);
}
}
}
PLEASE HELP ME FIX THE PROBLEM import java.util.Scanner; //import scanner input class Main { public static void main
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am