Question: The method passwordValidator takes two alpha-numeric passwords and returns true only if all the following conditions are met: i) Length of the password must be

The method passwordValidator takes two alpha-numeric passwords and returns true only if all the following conditions are met: i) Length of the password must be between 8 and 32 characters. ii) Password should contain at least one upper case and one lower case alphabet. iii) Password should contain at least two numbers. iv) Password should contain at least one special character from this list {!, _, %, $, #}. v) Both the password strings should match. The method passwordGenerator generates and returns a random password that satisfy the above-mentioned criteria with a specified length. Now, write a PasswordTester class, in which you should test these static methods. Here is an example test run: Enter a new password: test123 Re-enter the same password: test123 Password should contain at least 8 characters. Enter a new password: qwerty123 Re-enter the same password: qwerty123 Password must contain at least 1 capital letter character. Enter a new password: qwerTy123 Re-enter the same password: qwerTy123 Password must contain at least 1 special symbol. Enter a new password: qwerTy_1 Re-enter the same password: qwerTy_1 Password must contain at least 2 numbers. Enter a new password: qwerTy_12 Re-enter the same password: qwerty_12 Both passwords must match. Enter a new password: qwerTy_12 Re-enter the same password: qwerTy_12 Success! The above cases are sample only, when you test your code, you should test all possible cases. If the user cannot select a valid password within 7 tries, then your program should suggest 4 random passwords (with different length) to the user that satisfies all rules for the password.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!