Question
Name is a class that has first, middle initial, and last name as attributes. It has all get and set methods. To construct a name
Name is a class that has first, middle initial, and last name as attributes. It has all get and set methods. To construct a name requires first and last but middle initial is optional. Name should check that first, last and middle initial only contain letters and they should be stored with the first letter capital and the rest lower case. The middle initial should be stored as a single capital letter, if no middle initial was given then assign the character space to the variable. If the name is invalid the program should stop. Name should also have a toString method that displays the name as last,first, m.v The User constructor that takes the password as a parameter should do some verification. If the password is not at least 8 characters long and does not have at least 2 numbers and 1 uppercase letter it should prompt the user to enter a new password. This process should repeat until a valid password is entered. (Hint: remember to handle the case where the User was constructed without a password)v The setPassword method does not need verification because it can only be called from the changePassword method.v The User constructors and setId method should also verify that the id is 8 digits long. (Hint: use a method to reduce the need to rewrite the same code twice)v changePassword should make sure the parameter oldPass and the current password are the exact same. Then it should check that the newPass and newPass2 parameters are the exact same. Lastly it should make sure that newPass is a valid password and update the password attribute.v getFirst and getLast in User are to allow access to the names for later use.v computeGpa should return the average of the parameter.v Undergraduates constructor should check that the year is either freshman, sophomore, junior, or senior. If it isnt any of these it should be set to unknown.v All of Graduates attributes should be initialized to 0 and false.v updateGrade is used to change the Grade if it is better than the previous attempt and increase the attempts, or just increase the attempts. This method should also call the calculateAbleToGraduate method and return the appropriate String. (this student is able to graduate or this student is not able to graduate)v calculateAbleToGraduate should set the attribute ableToGraduate to true if the attempts is less than or equal to 2 and the grade is eighty or better.v
The Faculty constructor should use the following conversion table: dean 0 chair 1 professor 2 secretary 3 teaching assistant 4 otherwise -1 The faculty emails are generated by the first 6 letters of their last names followed by their first initial followed by @newpaltz.eduv Ex. Thomas Edwards -v> edwardt@newpaltz.edu Add a toString method to user that returns:v User id: # Name: last,first,m. Add a toString method to Undergraduate that returns:v User id: # Name: last,first,m. Year: Add a toString method to Graduate that returns:v User id: # Name: last,first,m. grade: # with # attempts Add a toString method to Faculty that returns:v User id: # Name: last,first,m. Position: # Email: generated email
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