Java Program

Need completed within 24 hours.

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

Assignment5 – Creating a Hierarchy of

Classes

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

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

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

3) Faculty extends Person

• date of hire – java.util.GregorianCalendar

• date of termination – java.util.GregorianCalendar

• salary – double

• classes currently teaching

• 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

7) FacultyClass extends OfferedClass

• ArrayList of students – ArrayList

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.

Ignore logger parts, have a seperate logger program already.

Please add the following to the OfferedClass file, along with a setter and getter for it:
private String classIdNumber;
You will notice in the test class that the class id field you are adding is of type float.

package TestStubs;
import emkramer.baseclasses.Classroom;
import emkramer.baseclasses.Faculty;
import emkramer.baseclasses.FacultyClass;
import emkramer.baseclasses.IPerson;
import emkramer.baseclasses.Person;
import emkramer.baseclasses.Student;
import emkramer.baseclasses.StudentClass;
import emkramer.utilities.Logger;
import java.util.GregorianCalendar;
/**
* @author Elizabeth Kramer
*/
public class TestBaseClassCreation {
public static void main (String[] args) {
Logger.enableLogging();
Logger.setDetailDebug();

// Create a Student
Student newStudent = new Student();
GregorianCalendar dob = new GregorianCalendar(75,7, 3);
newStudent.setDateOfBirth(dob);
newStudent.setName(“Kathy Smith”);
newStudent.setAddress(“1 Beech Ave”);
newStudent.setSSN(“567876567”);
GregorianCalendar dog = new GregorianCalendar(90, 6, 10);
newStudent.setDateOfGraduation(dog);

// Create a StudentClass
StudentClass studentClass = new StudentClass();
studentClass.setClassIdNumber(46.222f);
studentClass.setClassName(“C++ Programming”);
studentClass.setClassroom(new Classroom(“PA100”, ‘l’));

// Add grades to StudentClass
studentClass.getAllGrades().add(90.5f);
studentClass.getAllGrades().add(100f);
studentClass.getAllGrades().add(70.5f);
studentClass.getAllGrades().add(65f);
// Add the StudentClass to the Student
newStudent.getClasses().add(studentClass);
// Print out the data for the new student
Logger.logDebug(newStudent.toString());
// Create a faculty
Faculty faculty = new Faculty();
GregorianCalendar GregorianCalendarOfHire = new GregorianCalendar(85,12, 3);
faculty.setDateOfBirth(GregorianCalendarOfHire);
faculty.setName(“Elizabeth Kramer”);
faculty.setAddress(“1 University Ave”);
faculty.setSSN(“123456789”);
faculty.setStatus(‘f’);
GregorianCalendar GregorianCalendarOfTermination = new GregorianCalendar(30, 6, 10);
faculty.setDateOfHire(GregorianCalendarOfTermination);

// Create a faculty class
FacultyClass fc = new FacultyClass();
fc.setClassIdNumber(90.301f);
fc.setClassName(“Java Programming”);
fc.setClassroom(new Classroom(“FA309”, ‘c’));
// Add students to the class
fc.addStudent(newStudent);

// Add the class to a faculty
faculty.addClass(fc);
// Print out the faculty data
Logger.logDebug(faculty.toString());
}
}

Still stressed with your coursework?
Get quality coursework help from an expert!