Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java: please help with the following class. Thank you. Account class Superclass Instance variables clearPassword String Must be at least 8 characters long encryptedPassword :
Java: please help with the following class. Thank you.
- Account class
- Superclass
- Instance variables
- clearPassword
- String
- Must be at least 8 characters long
- encryptedPassword : String
- key
- int
- Must be between 1 and 10(inclusive)
- accountId - A unique integer that identifies each account
- nextIDNum a static int that starts at 1000 and is used to generate the accountID
- no other instance variables needed.
- clearPassword
- Default constructor set all instance variables to a default value.
- Parameterized constructor
- Takes in clearPassword, key.
- Calls encrypt method to create encryptedPassword
- setClearPassWord(String newPassword)
- Takes in a new clear text password.
- Calls encrypt method as the encrypted password would need to change.
- no encryptedPassword mutator method
- setKey(int newKey)
- Takes in a new key
- calls encrypt method as the encrypted password would need to change.
- accountId mutator - uses the static variable nextIDNum to retrieve the next available userID number
- encrypt method
- Uses the instance variables clearPassword and key to encrypt the password.
- Stores the encrypted password in the encryptedPassword instance variable
- toString - returns a nicely formatted String representing the instance variables of the Account class
NOTE: Your Account class should ensure the clearPassword is valid as described in the requirements. If not write an error message to the standard output and continue. Set the clearPassword and encyrptedPassword to the empty String.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started