Need help with this java problem. Some Websites impose certain rules for passwords. Write a method that checks whether a string is a valid password. The method must takes a password as a parameter and return a boolean value. If the password is valid, returns true, otherwise, return false. Suppose the password rules are as follows: - A password must have at least eight characters. - A password must contain only letters and digits. - A password must contain at least two digits. Please make sure you write a comment line to document what your method does. Write a program that prompts the user to enter a password, then call the method that checks the password, and displays "Valid Password" if the rules are followed, or Invalid Password otherwise. The main program must allow the user to check multiple passwords. It should ask the user "Do you want to continue checking anther password (y/n)?"
Need help with this java problem.
Some Websites impose certain rules for passwords.
Write a method that checks whether a string is a valid password. The method must takes a password as a parameter and return a boolean value. If the password is valid, returns true, otherwise, return false.
Suppose the password rules are as follows:
- A password must have at least eight characters.
- A password must contain only letters and digits.
- A password must contain at least two digits.
Please make sure you write a comment line to document what your method does.
Write a
are followed, or Invalid Password otherwise. The main program must allow the user to check multiple passwords. It should ask the user
"Do you want to continue checking anther password (y/n)?"
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images