Question: Learning Objectives: Implement multiple Java classes using inheritance and composition using a UML diagram to guide the program design. Demonstrate appropriate documentation of code using

Learning Objectives:
Implement multiple Java classes using inheritance and composition using a UML diagram to guide the program design.
Demonstrate appropriate documentation of code using class-level comments.
Use validation to maintain data integrity at the class level.
The classes needed are shown in the UML class diagram and listed. All classes are required to be in the same package with the package name cmsc256.
It is highly recommended that you create a new IntelliJ or Eclipse project for each project in this course. Once you create the project, find the src folder and create the cmsc256 package inside of the src folder.
The next step is to import the Name, Address and Directory classes that are provided for you. Be sure to place them all in the cmsc256 directory.
Name.javaDownload Name.java
Address.javaDownload Address.java
Directory.javaDownload Directory.java
Do not make any changes in Name and Address classes. If you make any changes to either the Name or Address class, your program will not compile and execute correctly in Gradescope.
Directory is the main class for the program. (Don't worry if there are errors showing up inside this class; it uses the Person class that you haven't written yet.) I expect you to use the main method to write tests for your code as you complete this assignment, so you are able to change this file. Don't worry if there are errors showing up inside this class.
Open each of these three files and read through them so that you understand the starter code for this project. If you have any questions about the starter files, please be sure to ask for clarification before starting to implement the remaining classes.
You are to implement the following classes:
Person Class: The class variables and types are shown in the class diagram. Specifically, RecordNumber is a static variable. It will increase each time you instantiate a new Person object and will be assigned to the id variable of the currently created instance. Here is the signature for the parameterized constructor of Person class:
public Person(String first, String middle, String last, Address homeAddress, String phoneNumber, String email)
Before continuing with the remaining classes, run the main method of the Directory class. (The errors should have been eliminated once you finished implementing Person.java.) The output at this point should be the following, if the toString() method in the Person class is correct:
Person:
---------------------------------------
Not provided Not provided
---------------------------------------
Home Address: None given
None given, VA 00000
Phone Number: None given
Email Address: None given
ID: 1
Remember that you should protect the validity of your instance variables using encapsulation. To do so, instance variables should be private and provide getters and setters to access them. Here are the rules that characterizes getters and setters:
Getter
A getter method have its name start with "get", take no parameters, and returns a value.
Setter
A setter method have its name start with "set", and takes 1 parameter that is to be the new value for the instance variable.
If the output is correct, feel free to comment out line 12 in the main method of Directory.java and continue with the implementation of the remaining classes.
Student Class: Student class extends Person class. It has extra variable, level, which indicates the student level as one of the following, Freshman, Sophomore, Junior, Senior, Graduate. Constructors of the Student class initialize the level variable in addition to all variables of superclass.
Employee Class: Employee class extends Person It has extra office, salary and dateHired variables. Constructors of the Employee class initialize all its variables.
Faculty Class: Faculty class extends Employee It has extra variable, rank, which can either be Adjunct, Instructor, Assistant Professor, Associate Professor, or Professor. Constructors of the Faculty class initialize all its variables.
Staff Class: Staff class extends Employee It has extra variable which is a String called title. Constructors of the Staff class initialize all its variables.
After completing the rest of the classes, uncomment the rest of the code in the main method of the Directory class. The correct output from executing the Directory program should look like this:
Student:
---------------------------------------
Peter Luong
---------------------------------------
Home Address: 10 FakeHome Street
Staged City, VA 22222
Phone Number: 858-789-8575
Email Address: fake0@ mymail.vcu.edu
ID: 1
Student Level: Freshman
Student:
---------------------------------------
Alice Myers
---------------------------------------
Home Address: 10 FakeHome Street
Staged City, VA 22222
Phone Number: 858-789-8576
Email Address: fake1@ mymail.vcu.edu
ID: 2
Student Level: Senior
Faculty:
--

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!