From a44a69759b6593bd268297fe3b594fbb54f5992f Mon Sep 17 00:00:00 2001 From: Jessica H Date: Wed, 9 Apr 2025 11:22:02 -0700 Subject: [PATCH 1/3] Hardcoded passward and printed it --- src/PasswordApp.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/PasswordApp.java b/src/PasswordApp.java index 86fb0b1..1497f34 100644 --- a/src/PasswordApp.java +++ b/src/PasswordApp.java @@ -1,5 +1,8 @@ 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 4995027291142e727a9abf4bde63fa5cb488efbf Mon Sep 17 00:00:00 2001 From: Jessica H Date: Wed, 9 Apr 2025 11:36:17 -0700 Subject: [PATCH 2/3] user input for password --- src/PasswordApp.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/PasswordApp.java b/src/PasswordApp.java index 1497f34..4118b0b 100644 --- a/src/PasswordApp.java +++ b/src/PasswordApp.java @@ -1,8 +1,18 @@ + +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(); 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 to short!!!"); + } } } \ No newline at end of file From d5eb0c8d0889c0dd7615be41319042bc17f19f83 Mon Sep 17 00:00:00 2001 From: Jessica H Date: Wed, 9 Apr 2025 12:05:20 -0700 Subject: [PATCH 3/3] checked to see if the user used a special char --- src/PasswordApp.java | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/PasswordApp.java b/src/PasswordApp.java index 4118b0b..7ca5b6f 100644 --- a/src/PasswordApp.java +++ b/src/PasswordApp.java @@ -6,13 +6,27 @@ public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Welcome to the password checker!"); - String password = scan.nextLine(); - System.out.println("The password is: " + password); + while(scan.hasNext()){ - if (password.length()>= 12){ - System.out.println("Your Password is a good length!"); - } else{ - System.out.println("Your password is to short!!!"); + 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 to short!!!"); + } + char[] characters = password.toCharArray(); + + boolean hasSpeacial = false; + + for(int i =0; i < characters.length; i++){ + char character = characters[i]; + if (Character.isAlphabetic(character) == false){ + hasSpeacial = true; + } + } + System.out.println("Has a special Character " + hasSpeacial); } } } \ No newline at end of file