Docsity

Object Oriented Programming - Programming Assignment 4 | COP 3330, Assignments of Computer Science

Toggle sidebar
bg1
Object Oriented Programming - Programming Assignment #4
Assigned: 3/21/06 (Tuesday)
Due: 4/11/06 (Tuesday) at 11:55pm WebCT time
Objective
To familiarize you with the use of inheritance.
Deliverables
All source files you produce must be turned in through WebCT by 11:55 on Tuesday,
April 11. They should all be within a single .zip file.
Description
In this assignment, you will create a class hierarchy to represent the people within a
university, and another class hierarchy to represent departments of a university. To create
this class hierarchy, you will create a set of classes and these classes will have inheritance
relations among them. All classes must be in separate files in the “university” package.
You will be provided a class file which will make use of the classes you write, so it is
absolutely vital that you match the accompanying html documentation. The functionality
you are to provide in your classes is outlined below.
People
The people within a university (UniversityMember) can be categorized as either
employees (Employee) or students (Student). An employee is either a faculty member
(Faculty) or support personnel (SupportPersonnel). Every person in the university has a
first name, a last name, an address, and a social security number, all of which should be
strings. In addition, students have a GPA which should be a double. Faculty members
have title, such as “Associate Professor” or “Adjunct” which should be a string. All data
fields should be private or protected as appropriate. UniversityMember and Employee
should be abstract classes.
Methods
Student, Faculty, and SupportPersonnel should override the toString method to produce
strings in the output format shown later in this document. Your UniversityMember
should implement the interface Comparable<UniversityMember>. The compareTo
method should impose a natural ordering based upon the last name. If the last names of
two people are equal, then order them based on first name. If two people have both the
same first and last name, then order them based on SSN. Each class representing people
should also have accessor methods for each of the data fields.
pf3
pf4
pf5

Partial preview of the text

Download Object Oriented Programming - Programming Assignment 4 | COP 3330 and more Assignments Computer Science in PDF only on Docsity!

Object Oriented Programming - Programming Assignment

Assigned: 3/21/06 (Tuesday)

Due: 4/11/06 (Tuesday) at 11:55pm WebCT time

Objective To familiarize you with the use of inheritance. Deliverables All source files you produce must be turned in through WebCT by 11:55 on Tuesday, April 11. They should all be within a single .zip file. Description In this assignment, you will create a class hierarchy to represent the people within a university, and another class hierarchy to represent departments of a university. To create this class hierarchy, you will create a set of classes and these classes will have inheritance relations among them. All classes must be in separate files in the “university” package. You will be provided a class file which will make use of the classes you write, so it is absolutely vital that you match the accompanying html documentation. The functionality you are to provide in your classes is outlined below.

People

The people within a university (UniversityMember) can be categorized as either employees (Employee) or students (Student). An employee is either a faculty member (Faculty) or support personnel (SupportPersonnel). Every person in the university has a first name, a last name, an address, and a social security number, all of which should be strings. In addition, students have a GPA which should be a double. Faculty members have title, such as “Associate Professor” or “Adjunct” which should be a string. All data fields should be private or protected as appropriate. UniversityMember and Employee should be abstract classes. Methods Student, Faculty, and SupportPersonnel should override the toString method to produce strings in the output format shown later in this document. Your UniversityMember should implement the interface Comparable. The compareTo method should impose a natural ordering based upon the last name. If the last names of two people are equal, then order them based on first name. If two people have both the same first and last name, then order them based on SSN. Each class representing people should also have accessor methods for each of the data fields.

Departments

Each department (Department) within a University is either an academic department (AcademicDepartment) such as the Computer Science department, or a non-academic department (NonAcademicDepartment) such as the physical plant. All departments have a set of employees and a name (e.g. “Computer Science”). Academic departments, in addition to having employees, also have a set of students. Methods Both types of departments should override the toString method to produce strings in the output format shown later in this document. Department should implement the interface Comparable with the compareTo method imposing a natural ordering based only on the name of the department. There should be methods to add and remove employees and to retrieve a set of all employees working for the department. Academic departments also need to have methods to add and remove students and to retrieve a set of all students.

Very Important Note

Although you won't be turning in a main method in your submission, it's very, very important that you test all of your methods thoroughly by writing a main method of your own. Before you submit the assignment however, delete any main methods you may have used for testing purposes. We will test your classes by calling each method you have written according to the specification in the Javadocs.

toString output format

Our code is going to make use of your toString methods in order to write a file. Our code will take care of reading and interpreting that file on its own, so it is very important that your toString method produces strings in the correct format. The following are samples of strings that should be produced by your toString methods. Anything in bold in a sample is specific to a particular person/department and should vary depending on the contents of the records. Student Student Last name: Kirk First name: James SSN: 123-45- Address: 1701 Enterprise Drive GPA: 3. Faculty Faculty

SupportPersonnel SupportPersonnel Last name: O’Brien First name: Miles SSN: 121-23- Address: 9 Deep Space Circle The toString methods of the departments should make use of the toString methods of each University member it contains. The parts that should come from university member toString methods are bold and italicized. AcademicDepartment =================== Academic Department Potions =================== Employees

SupportPersonnel Last name: O’Brien First name: Miles SSN: 121-23- Address: 9 Deep Space Circle --------- Faculty Last name: Snape First name: Severus SSN: 111-22- Address: 1998 Hogwarts Lane Title: Professor --------- Students --------- Student Last name: Kirk First name: James SSN: 123-45- Address: 1701 Enterprise Drive GPA: 3.

Non-Academic Department

Non-Academic Department Physical Plant =================== Employees

SupportPersonnel Last name: Tucker First name: Charles SSN: 444-44- Address: 01 NX Way

SupportPersonnel Last name: La Forge First name: Geordi SSN: 555-55- Address: 1701 Enterprise Drive, Apt. D