Often the IT department or a Web site imposes certain restrictions on what can b
ID: 3640661 • Letter: O
Question
Often the IT department or a Web site imposes certain restrictions on what can be a password.Assume the following rules for passwords:
• A password must be at least six characters long
• A password may contain only letters and digits
• A password must contain at least two digits
Add a method to the Sentence class called isPassword which returns true if this Sentence is a valid password. Otherwise it returns false. Do not remove the isPalindrome method. You are enhancing the class. You want to add new functionality but leave all the ole functionality alone.
The header for the method is:
public boolean isPassword()
Notice that the method does not take a parameter.
Now write a test application that prompts the user to enter a possible password and displays "Valid Password" if the rules are followed or "Invalid Password" otherwise. Test the application thoroughly.