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!
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!
Chapter7: Characters, Strings, And The Stringbuilder
Section: Chapter Questions
Problem 7PE
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!](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F05d3dbe3-f8dd-49bf-859b-80eac9ded840%2Fe5ac67d5-a2d8-4dac-aa9b-eabda95685f1%2Fyyxwz2g_processed.png&w=3840&q=75)
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
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 4 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
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.Recommended textbooks for you
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781305480537/9781305480537_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781305480537/9781305480537_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage