(Creating Custom Exception Class) Write a Password class that stores a password string
(Creating Custom Exception Class) Write a Password class that stores a password string
Programming with Microsoft Visual Basic 2017
8th Edition
ISBN:9781337102124
Author:Diane Zak
Publisher:Diane Zak
Chapter2: Planning Applications And Designing Interfaces
Section: Chapter Questions
Problem 1MQ3
Related questions
Question
(Creating Custom Exception Class) Write a Password class that stores a password string. Passwords must contain at least seven alpha-numeric characters, with at least one letter and one digit. Also write an InvalidPasswordException class that extends Exception. The Password constructor should throw an InvalidPasswordException, which should report an appropriate message based on a given string (e.g. if the string contains no digits, the exception should report this fact).
Use java swing to write a GUI program to prompt the user to enter a password and report an InvalidPasswordException if an invalid password is entered. Some sample screenshots are shown below:
![Set Password
Enter your password
Submit
Your password should have at least 1 digit.
Your password should have at least 7 alpha-numeric
characters.
Set Password
Enter your password
Submit
Congratulations! Your password is valid.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F285003f4-8484-455a-be8b-60ecdbd88ce4%2F8e61ed41-1c94-47e2-bd79-be2683864820%2F7b975p_processed.png&w=3840&q=75)
Transcribed Image Text:Set Password
Enter your password
Submit
Your password should have at least 1 digit.
Your password should have at least 7 alpha-numeric
characters.
Set Password
Enter your password
Submit
Congratulations! Your password is valid.
![Set Password
Enter your password
Submit
Invalid password: password cannot be null or an empty string
Set Password
O X
Enter your password
Submit
Your password should have at least 1 letter.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F285003f4-8484-455a-be8b-60ecdbd88ce4%2F8e61ed41-1c94-47e2-bd79-be2683864820%2Fuh1cc0d_processed.png&w=3840&q=75)
Transcribed Image Text:Set Password
Enter your password
Submit
Invalid password: password cannot be null or an empty string
Set Password
O X
Enter your password
Submit
Your password should have at least 1 letter.
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 2 steps
![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
![Programming with Microsoft Visual Basic 2017](https://www.bartleby.com/isbn_cover_images/9781337102124/9781337102124_smallCoverImage.gif)
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
![Programming with Microsoft Visual Basic 2017](https://www.bartleby.com/isbn_cover_images/9781337102124/9781337102124_smallCoverImage.gif)
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning