Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Define organisational structure

Answered: 1 week ago

Question

Define line and staff authority

Answered: 1 week ago

Question

Define the process of communication

Answered: 1 week ago

Question

Explain the importance of effective communication

Answered: 1 week ago

Question

* What is the importance of soil testing in civil engineering?

Answered: 1 week ago