diff --git a/passwords b/passwords new file mode 100644 index 0000000..b28064b --- /dev/null +++ b/passwords @@ -0,0 +1,3 @@ +hello +hello123 +hellothere12345 \ No newline at end of file diff --git a/src/PasswordApp.java b/src/PasswordApp.java index 86fb0b1..54879bb 100644 --- a/src/PasswordApp.java +++ b/src/PasswordApp.java @@ -1,5 +1,35 @@ +import java.util.Scanner; + public class PasswordApp { public static void main(String[] args) { + Scanner scan = new Scanner(System.in); System.out.println("Welcome to the password checker!"); + System.out.println("Please enter the desired password"); + + while (scan.hasNextLine()){ + String password = scan.nextLine(); + System.out.println("The password is: " + password); + + if(password.length() >= 12){ + System.out.println("Your password is a good length!"); + } else { + System.out.println("Your password is too short!!!"); + } + + //make char array from user input + char[] characters = password.toCharArray(); + + boolean hasSpecialChar = false; + + for (int i = 0; i < characters.length; i++){ + char character = characters[i]; + if(Character.isAlphabetic(character) == false){ + hasSpecialChar = true; + } + } + + System.out.println("Password has a special character: " + hasSpecialChar); } + +} } \ No newline at end of file