The program allows the user to enter a string representing a password and determines whether or not it is valid. The password must be 8 characters long, include one lower case letter, one upper case letter, a number, and a symbol (ex. !@#).
The output should read:
Entered Password: (whatever the user entered)
Verdict: (either valid or invalid)
Here is my code so far:
import java.util.*;
public class PasswordTest
{
public static void main(String[]args)
{
Scanner input = new Scanner (System.in);
System.out.print("Enter a password: ");
String Pass = input.next();
System.out.println("Entered Password: " + Pass);
if (Pass.length() < 8)
{
System.out.println ("Verdict: Invalid");
}
if (Pass.length() >= 8)
{
System.out.println ("Verdict: Valid");
{
}
}
I'm not certain how to go about this. I'm assuming I'll need a loop statement to determine whether or not it contains a capital and lowercase letter as well as a number and symbol.