tolong betulkan

salam ..siapa tahu kenapa bila run code ni dalam netbeans…dia kata password masih weak..pening da buattt RCverysad

//imports for scanner
import java.util.Scanner;
//public class declaration
public class yyoo
{
//main
public static void main (String[] args)
{
//user input and variable defenitions
Scanner Keyboard = new Scanner(System.in);
System.out.println(“Enter your password”);
String password = Keyboard.nextLine();

int c1; //c1= represent password 1 special character, 1 number,length of 8,least 1 of small or upper case.
int c2; //c2= represent 3 word (i.e this is it, how are you)
int c3; //c3= represent combine c1 and c2
int score = 0;

// boolean failFlag = false;
int count = 0;

//if statement for len

if (password.length() >= Glasses
{
score++;
if (password.length() >= 10)
{
score = score + 2;
}
}

//initial for loop that is used for each if statement
for (int i = 0 ; i < password.length(); i++)
{
//several if statements for checking numbers symbols and upper/lowercase
//symbols
if(password.charAt(i) >= 33 && password.charAt(i) <= 47)
{
count++;
score++;
count = 0;
if (count >= 1)
{
score = score + 2;

}
}
}
//numbers
for ( int i = 0 ; i < password.length(); i++)
{
if (password.charAt(i) >= 48 && password.charAt(i) <= 57)
{
count++;
score++;
count = 0;
if (count >= 1)
{
score = score++;

}
}
}
//upper and lowercase
for (int i = 0 ; i < password.length(); i++)
{
if(password.charAt(i) >= 97 && password.charAt(i) <= 122)
{

score++;
}

}

//final score
System.out.println(“Score: ” + score);
//while loop for password
while ( ! password.equals(“password”) && !password.equals(“12345678″) && !password.equals(“password1″))
{

//if statements to determine score
if (score > 9)
{
System.out.println(“Exellent Password”);
break;
}

if (score < 9 && score > 7)
{
System.out.println(“Strong Password”);
break;
}

if (score < 7 && score > 5)
{
System.out.println(“Medium Password”);
break;
}

if (score < 5 && score > 0)
{
System.out.println(“Weak Password”);
break;

}

}
//failure condition
if (password.equals(“password”))
{
System.out.println(“Your password fails the criteria”);
}

}
}

Sumber: http://rc.my


0 Response to "tolong betulkan"

Post a Comment