Documente Academic
Documente Profesional
Documente Cultură
Example:
Input password =
Sbq250.4e
2. Evaluating length
A new integer variable lengthScore is created here to store the score after evaluation. By
using if statement, the password’s length is tested whether to be <8 characters, 8-12 characters, or
>12 characters, then the code outputs a corresponding comment which are ‘too short’, ‘good on
average’, and ‘great length’ respectively; this judgement is based on the recommended length in
multiple referenced sites. The lengthScore is then 1, 2, and 3, for they are the smallest countable
numbers.
S uppercase
b, q, e letter
2, 5, 0, 4 number
. symbol
Sbq250.4e
The concatenation begins with lengthScore then typeScore; the number is turned into a
string and assigned to the string variable result. Lastly, the switch statement compares result with
each possible case; it is faster to use the switch statement than to use the if statement because it
checks only the matching case and exits the checking right away with break keyword. When it
finds a match, the corresponding letter grade is announced, and the program ends.
The lengthScore = 2
The typeScore = 4
Result = 24
Appendix: draft
References
Allen, S. (n.d.). Java Character: isLetter, isDigit and toLowerCase. Retrieved from Dot Net
Perls: https://www.dotnetperls.com/character-java
Hoffman, C. (2018, May 19). How to Create a Strong Password (and Remember It). Retrieved
from How-To Geek: https://www.howtogeek.com/195430/how-to-create-a-strong-
password-and-remember-it/
University, A. S. (n.d.). Password Guidelines. Retrieved from Information Technology:
https://www.angelo.edu/services/technology/it_policies/password_quality.php