import java.util.Scanner;
public class Password2
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
System.out.println("Welcome please enter your password.>>");
enterPassword();
String password = "";
String enterPassword = "";
//keep going until we get an acceptable password
while(!CheckPassword(password))
{
password =(enterPassword);
}
System.out.println("Password accepted");
}
public static Boolean CheckPassword(String password)
{
//perform all password checks
Boolean passedLength = checkPasswordLength(password);
Boolean passedLetter = checkPasswordLetter(password);
Boolean passedDigit = checkPasswordDigit(password);
return (passedLength && passedLetter && passedDigit);
}
public static String enterPassword(){
String password;
Scanner input = new Scanner(System.in);
System.out.print("Password >>");
password = input.nextLine();
return password;
}
public static Boolean checkPasswordLength(String password)
{
//passes if there is a string value, and it has 6+ characters
int length;
length = password.length();
while (length <6){
enterPassword();
}
{
checkPasswordLetter(password);
}
return true;
}
public static Boolean checkPasswordLetter(String password)
{
int let = 1;
while (let <1)
{
enterPassword();
}
{
checkPasswordDigit(password);
}
return true;
}
public static Boolean checkPasswordDigit(String password)
{
int digit = 1;
while (digit >=1)
{
System.out.println("Password accepted");
}
{
enterPassword();
}
return true;
}
}