Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions passwords
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
hello
hello123
hello1234567890
30 changes: 30 additions & 0 deletions src/PasswordApp.java
Original file line number Diff line number Diff line change
@@ -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!");

while (scan.hasNextLine()){

String password = scan.nextLine();

System.out.println("The password is: " + password);

if (password.length() < 12){
System.out.println("Password length is too short.");
} else {
System.out.println("Your password is a good length.");
}

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);
}
}
}