Question: CODE IN JAVA Develop a set of classes that form a hierarchy for persons where a Person can be a Student or an Instructor. Also,
CODE IN JAVA


Develop a set of classes that form a hierarchy for persons where a Person can be a Student or an Instructor. Also, develop the aggregation between the class Project and the classes Instructor and Student. Person class: Include fields that are common to students and instructors: Strings firstName and lastName and integer birthYear. The Person class has a getName() method that returns a concatenation of their first name and last name (e.g., Sirius Black). Override the toString() method to return a string that includes the person's name and birth year. Include a full-arg constructor and getter methods. Student and Instructor Subclasses: Include the following string type fields for each of the subclasses: Student: major, studentNumber Instructor: degree, office Both classes must have full-arg constructors that call the person constructor. Getters and setters are not necessary. Include copy constructors to be used by the aggregate Project class. Project class: It has one string type field (projectTitle) with its getter and two object type fields (instructor and student). Include a full-arg constructor that makes use of the copy constructors of both constituent classes. Demonstrate the usage of your classes with a program named Test that instantiates three Project objects and adds them to an ArrayList. Using a for loop and the getName() method, the program displays the projects' information in the following format: Project title Instructor full name Student full name Output example: Malware Detection using Attack Trees Sirius Black Harry Potter Machine Learning for Anomaly Prediction Simon Rackspace Jerry Field Development of Data Analysis for Disease Investigation Cruella De Vil Elijah Wood Suggestion: Construct a UML diagram to represent the class hierarchy and aggregation before starting the development of your code
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
