Question
Utility Class Create a PasswordCheckerUtility class based on the Javadoc given you. The PasswordCheckerUtility class will have at least three methods: One method will check
Utility Class
Create a PasswordCheckerUtility class based on the Javadoc given you. The PasswordCheckerUtility class will have at least three methods: One method will check the validity of one password and return true if the password is valid and throw an exception if invalid.
One method will check for a weak password, i.e., one whose length is between 6 and 9, inclusive. Do NOT throw an exception.
One method will check an ArrayList of passwords and return an ArrayList with the status of any invalid passwords (weak passwords are not considered invalid). The ArrayList of invalid passwords will be of the following format:
The methods will have the following headers:
static boolean isValidPassword(String pwdString);
static boolean isWeakPassword(String pwdString);
static ArrayList
Always check for the length of the password first, since that is the easiest and fastest check. Once the password fails one rule, you do not need to check the rest of the rules.
JAVA DOC
Class PasswordCheckerUtility
java.lang.Object PasswordCheckerUtility public final class PasswordCheckerUtility extends java.lang.Object
Constructor Summary PasswordCheckerUtility()
Method Summary static boolean isValidPassword(java.lang.String passwordString) Return true if valid, returns false if an invalid password static boolean isWeakPassword(java.lang.String passwordString) Return true if length of password is greater or equal to 6 but less than or equal to 9 static java.util.ArrayList
Methods inherited from class java.lang.Object equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Constructor Detail PasswordCheckerUtility
public PasswordCheckerUtility() Method Detail isValidPassword
public static boolean isValidPassword(java.lang.String passwordString) throws LengthException, NoDigitException, NoUpperAlphaException, NoLowerAlphaException, InvalidSequenceException Returns true if valid password. Throws exceptions for invalid passwords. Valid if password is greater than or equal to 6 characters, has at least one digit, has at least on upper-case alphabetic character, has at least on lower-case alphabetic character, and has no more than two of the same character in a row.
Parameters:
passwordString - - string to be checked for validity
Returns:
true if valid password, set up to return false if an invalid password, but throws an exception instead.
Throws:
LengthException - thrown if length is less than 6 characters
NoDigitException - thrown if no digit
NoUpperAlphaException - thrown if no uppercase alphabetic
NoLowerAlphaException - thrown if no lowercase alphabetic
InvalidSequenceException - thrown if more than 2 of same character.
isWeakPassword
public static boolean isWeakPassword(java.lang.String passwordString) Return true if length of password is greater than or equal to 6 but less than or equal to 9
Parameters:
passwordString - - string to be checked if weak password
Returns:
true if length of password is greater than or equal to 6 but less than or equal to 9
invalidPasswords
public static java.util.ArrayList
Parameters:
passwords - arraylist of passwords to check for validity
Returns:
arraylist of invalid passwords. It will not return weak passwords.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started