Program language is java Suppose a website impose 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 a invalid password, the program needs 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 (My password18 → pass 18 → password → Mypassword18): 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 Yalid password!

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter7: Characters, Strings, And The Stringbuilder
Section: Chapter Questions
Problem 7PE
icon
Related questions
Question

errrew

Program language is java
Suppose a website impose 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 a 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
(My password18 → pass 18 → password → Mypassword18):
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: Mypassword 18
Valid password!
Transcribed Image Text:Program language is java Suppose a website impose 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 a 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 (My password18 → pass 18 → password → Mypassword18): 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: Mypassword 18 Valid password!
Expert Solution
steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Study of Characters
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage