Text: Program language is Java.
Suppose a website imposes the following rules for passwords:
1. A password must have at least eight characters.
2. A password consists of only letters and digits.
3. A password must contain at least two digits.
Write a program that prompts the user to enter a password. If the user enters an invalid password, the program needs to tell the user why it is invalid and ask the user to enter another password. The program should stop only when the user enters a valid password.
Here is one sample run to check these 4 passwords in order: (8IpIoMssedKW <pioMssed 8(ssed 8IpioMssed KW)
Enter a new password: My password18
Invalid: Only letters and digits
Enter a new password: pass18
Invalid: Too Few Characters (8 at least)
Enter a new password: password
Invalid: At least two digits
Enter a new password: Mypassword18
Valid password!