Java Program

profileBearbear
assignment.pdf

Assignment 5 – Creating a Hierarchy of Classes

Part 1. Create the following classes using the data types as noted.

1) Person implements IPerson

•name - String

•address - String

•social security number - String

•date of birth - java.util.GregorianCalendar

2) Student extends Person

•date of graduation - java.util.GregorianCalendar

•current GPA - float

•classes currently enrolled in ArrayList<StudentClass>

3) Faculty extends Person

• date of hire - java.util.GregorianCalendar

• date of termination - java.util.GregorianCalendar

• salary - double

• classes currently teaching <FacultyClass>

• status - char (p - part time, f - full time)

4) Classroom

• room number - String

• status - char (l - lab, c - classroom, h - lecture hall)

5) OfferedClass implements IOfferedClass

• room - Classroom

• name - String

6) StudentClass extends OfferedClass

• ArrayList of grades - ArrayList<Float>

7) FacultyClass extends OfferedClass

• ArrayList of students - ArrayList<Student>

Part 2. Create the following methods for all of the classes

1) toString 2) setters and getters for all variables

Helpful Hints:**

- Create all the interfaces first.

- Create the classes from least specific to most specific.

- Notice that some of the classes contain variables that are other classes. Don’t let this throw you for a loop. Remember that this is a form of the “has-a” relationship, or what we call, “composition”.

- We will be using a new java class called “GregorianCalendar” to store dates. Take some time to look at the documentation for this class.