Write a program that hardcodes a proposed password and checks that it is an acceptable password.
If the proposed password is acceptable password, the program writes a message "Password zzzzzzzzz is acceptable" and ends.
If it is not acceptable, it writes a message "Password is acceptable because it "
Where
is the password which was checked.
is one of:
"is not at least 7 characters long."
"does not contain both upper and lower case alphabetic characters."
"does not contain at least 1 digit."
is used if the PW is not acceptable, else the word not isn't printed.
"is an acceptable password."
Acceptable passwords:
are at least 7 characters long.
contain both upper and lower case alphabetic characters.
contain at least 1 digit.
The logic of this program can be quite tricky. Hint: use toUpperCase(), toLowerCase, and equals(). You will also need nested ifs.
Here some sample runs of the program; your output should look substantially the same:
C:\>java PasswordChecker
Enter your password:
snowflake
Password snowflake is not acceptable because it does not contain both upper and lower case alphabetic characters."
Enter your password:
SnowFlake