Write a class definition to simulate a user
account with a password (UML diagram below).
The basic functionality that we want is to be able to allow the user to
log in and out, and to reset the password. To log in, the correct
password must be given (parameter of the logIn method).
If an attempt is made to log in with the wrong password, the user will
not get logged in. To reset the password, the current password
must be given as well as the new password (if the current password is
incorrect, the password will not be reset - it remains the same).
Passwords must have at least 8 characters.| UserAccount |
|
- loginID : String - password : String - loggedIn : boolean |
|
+ setLoginID(String newLoginID) : void + getLoginID() : String + isLoggedIn() : boolean - isPassword(String aPassword) : boolean - isValidPassword(String aPassword) : boolean + setPassword(String curPassword, String newPassword) : void + logIn(String aPassword) : void + logOut() : void + equals(UserAccount otherUser) : boolean + toString() : String |