<aside> 🚧 Exception Handling (Low Difficulty)
</aside>
Create the following classes that simply extend the Exception
class:
InvalidUsernameException
InvalidPasswordException
InvalidAgeException
PasswordMismatchException
In the Account
class, code a method called createAccount
that takes a username
, age
, password
, and confirmPassword
as parameters.
In createAccount
, throw an:
InvalidUsernameException
- if the given username is <4 or >10 characters.InvalidPasswordException
- if the given password is <4 or >10 characters.InvalidAgeException
- if the given age is <18.PasswordMismatchException
- if the given password does not match the given confirm password.In your main
method (within the Account
class):