Question: Assignment: Create a Person.java super class It should contain the following attributes: int id String title (e.g. Mr. Ms., Dr, etc.) String firstName String lastName
Assignment:
- Create a Person.java super class
- It should contain the following attributes:
- int id
- String title (e.g. Mr. Ms., Dr, etc.)
- String firstName
- String lastName
- Calendar birthDate
- It should contain the following methods
- Accessors (getter methods) to all attributes
- Mustators (setter methods) to all attributes
- a toString() method that returns all the objects contents in a concatenated, readable string.
- a displayName() method that returns a String in the following sample format: Mr. John Doe.
- Over-loaded constructers: no-arg and one that accepts all 5 project attributes
- It should contain the following attributes:
- Create a Student.java child that inherits from person. It should contain a classification attribute (freshman, sophomore, etc) and its associated getter/setter. It should also over-rode toString(). Over-load the constructor to take 0, 5, or 6 arguments, each invoking the appropriate super() constructor
- Create a Faculty.java child that inherits from person. It should contain a degree attribute that is as a
ArrayList and its associated getter/setter. In addition to over-riding toString(), it should also over-ride the displayName() method to returns a string that includes the *first* degree in the ArrayList (e.g. Dr. John Doe, PhD.) Over-load the constructor to take 0, 5, or 6 arguments, each invoking the appropriate super() constructor.
- Write a Lab1.java tester that exercises all constructors, accessors, mutators, as well as the toString() and displayName () methods.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
