From 31cbb1d0c8f1efbb0db129dcd21ce99ffd6f576a Mon Sep 17 00:00:00 2001 From: Kelley Castillo Date: Wed, 9 Apr 2025 11:09:30 -0700 Subject: [PATCH 1/3] hardcoded password and printed it --- src/PasswordApp.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/PasswordApp.java b/src/PasswordApp.java index 86fb0b1..63544cb 100644 --- a/src/PasswordApp.java +++ b/src/PasswordApp.java @@ -1,5 +1,9 @@ public class PasswordApp { public static void main(String[] args) { System.out.println("Welcome to the password checker!"); + + String password = "hello123"; + + System.out.println("The password is: " + password); } } \ No newline at end of file From 70e192b5ef99acd7b391159bdaa8fddd7483a9a2 Mon Sep 17 00:00:00 2001 From: Kelley Castillo Date: Wed, 9 Apr 2025 11:24:08 -0700 Subject: [PATCH 2/3] added password scanner --- src/PasswordApp.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/PasswordApp.java b/src/PasswordApp.java index 63544cb..b08bcd3 100644 --- a/src/PasswordApp.java +++ b/src/PasswordApp.java @@ -1,9 +1,17 @@ +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!"); - String password = "hello123"; + String password = scan.nextLine(); //scans user input System.out.println("The password is: " + password); + + if(password.length() >= 12) { + System.out.println("Password met characterized length"); + }else { + System.out.println("Password has not met requirement(s)"); + } + } } -} \ No newline at end of file From 0e0eab8e102afc3dfbd28d3c8a6b6c3d531f6511 Mon Sep 17 00:00:00 2001 From: Kelley Castillo Date: Wed, 9 Apr 2025 11:51:04 -0700 Subject: [PATCH 3/3] support for passwords --- src/PasswordApp.java | 27 +++++++++++++++++++++------ src/passwords | 3 +++ 2 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 src/passwords diff --git a/src/PasswordApp.java b/src/PasswordApp.java index b08bcd3..a2d9453 100644 --- a/src/PasswordApp.java +++ b/src/PasswordApp.java @@ -4,14 +4,29 @@ public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Welcome to the password checker!"); - String password = scan.nextLine(); //scans user input + while(scan.hasNextLine()) { + String password = scan.nextLine(); //scans user input - System.out.println("The password is: " + password); + System.out.println("The password is: " + password); - if(password.length() >= 12) { - System.out.println("Password met characterized length"); - }else { - System.out.println("Password has not met requirement(s)"); + if(password.length() >= 12) { + System.out.println("Password met characterized length"); + }else { + System.out.println("Password has not met requirement(s)"); + } + + char[] characters = password.toCharArray(); + + boolean hasSpecial = false; //scans user input if it has numerical value + + for (int i=0; i< characters.length; i++) { + char character = characters[i]; + System.out.println(Character.isAlphabetic(character) == false); { + hasSpecial = true; + } + } + System.out.println("Has a special character" + hasSpecial); } } } + diff --git a/src/passwords b/src/passwords new file mode 100644 index 0000000..9d8eadb --- /dev/null +++ b/src/passwords @@ -0,0 +1,3 @@ +hello +hello123 +hello123456 \ No newline at end of file