From 172da49815f27ba6239ba6f0876005e71fd7ff01 Mon Sep 17 00:00:00 2001 From: Masih Date: Wed, 9 Apr 2025 11:09:58 -0700 Subject: [PATCH 1/3] Created a string for the password --- src/PasswordApp.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/PasswordApp.java b/src/PasswordApp.java index 86fb0b1..390f761 100644 --- a/src/PasswordApp.java +++ b/src/PasswordApp.java @@ -1,5 +1,10 @@ public class PasswordApp { public static void main(String[] args) { + System.out.println("Welcome to the password checker!"); + String password = "helllo123"; + + System.out.println("The password is : " + password); + } } \ No newline at end of file From 8e994b3057e51604f7744577c1efe34f51e25bd1 Mon Sep 17 00:00:00 2001 From: Masih Date: Wed, 9 Apr 2025 11:25:00 -0700 Subject: [PATCH 2/3] We added the lenght chacker, and user input --- src/PasswordApp.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/PasswordApp.java b/src/PasswordApp.java index 390f761..a628b32 100644 --- a/src/PasswordApp.java +++ b/src/PasswordApp.java @@ -1,10 +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 = "helllo123"; + String password = scan.nextLine(); System.out.println("The password is : " + password); + if(password.length() >= 12){ + System.out.println("Your password is a good lenght!"); + }else { + System.out.println("Your passowrd is too short"); + } } } \ No newline at end of file From 93dbd88c556781f9558b361cd7fe7f6997d81a02 Mon Sep 17 00:00:00 2001 From: Masih Date: Wed, 9 Apr 2025 11:51:35 -0700 Subject: [PATCH 3/3] We add mulitiple passwords --- src/PasswordApp.java | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/PasswordApp.java b/src/PasswordApp.java index a628b32..ce4ceda 100644 --- a/src/PasswordApp.java +++ b/src/PasswordApp.java @@ -5,14 +5,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(); + while (scan.hasNextLine()){ - System.out.println("The password is : " + password); - if(password.length() >= 12){ + + String password = scan.nextLine(); + + System.out.println("The password is : " + password); + if(password.length() >= 12){ System.out.println("Your password is a good lenght!"); - }else { + }else { System.out.println("Your passowrd is too short"); - } + } + + char[] characters = password.toCharArray(); + + boolean hasSpecial = false; + for (int i = 0; i < characters.length; i++){ + char character = characters[i]; + if(Character.isAlphabetic(character) == false){ + hasSpecial = true; + } + } + System.out.println("Has a special character " + hasSpecial); + } } } \ No newline at end of file