- Create a
Personclass.Personconstructor should have a parameter of typeStringwhich sets thenameinstance-variable to the respective value.Personshould have agetName()method which returns thePersonobject'snamevariable.Personshould have asetName()method which sets thePersonobject'snamevariable.
- Create a
TestPersonclass.- Create a
testSetNamemethod which ensures that aPersonobject'snamevariable is being set by invoking the.setNamemethod. - Create a
testConstructormethod which ensures that aPersonobject'snamevariable is being set by invoking thePersonconstructor.
- Create a
- Create a
Learnerinterface.Learnershould declare one method signature:- Method name:
learn - Method parameters:
double numberOfHours - Method return-type:
void
- Method name:
- Create a
Studentclass such that:Studentis a subclass ofPersonStudentimplements theLearnerinterfaceStudentshould have an instance variabletotalStudyTimeof typedoubleStudentshould have a concrete implementation of thelearnmethod which increments thetotalStudyTimevariable by the specifiednumberOfHoursargument.Studentshould have agetTotalStudyTime()method which returns thetotalStudyTimeinstance variable.
- Create a
TestStudentclass.- Create a
testImplementationmethod that asserts that aStudentis aninstanceofaLearner. - Create a
testInheritancemethod that asserts that aStudentis aninstanceofaPerson. - Create a
testLearnmethod that ensures aStudent'stotalStudyTimeinstance variable is incremented by the specifiednumberOfHoursby invoking the.learnmethod.
- Create a
- Create a
Teacherinterface.-
Teachershould declare ateachmethod signature:- Method name:
teach - Method parameters:
Student studentdouble numberOfHours
- Method return-type:
void
- Method name:
-
Teachershould declare alecturemethod signature:- Method name:
lecture - Method parameters:
Student[] student, double numberOfHours
- Method return-type:
void
- Method name:
-
- Create an
Instructorclass such that:Instructoris a subclass ofPersonInstructorimplements theTeacherinterfaceInstructorshould have a concrete implementation of theteachmethod which invokes thelearnmethod on the specifiedStudentobject.Instructorshould have a concrete implementation of thelecturemethod which invokes thelearnmethod on the specified array ofStudentobjects.numberOfHoursshould be evenly split amongst the students.double numberOfHoursPerStudent = numberOfHours / students.length;
- Create an
TestInstructorclass.- Create a
testImplementationmethod that asserts that anInstructoris aninstanceofaTeacher. - Create a
testInheritancemethod that asserts that aInstructoris aninstanceofaPerson. - Create a
testTeachmethod that ensures when anInstructorinvokes the.teachmethod, a respective student'stotalStudyTimeinstance variable is incremented. - Create a
testLecturemethod that ensures when anInstructorinvokes the.teachmethod, a respective student'stotalStudyTimeinstance variable is incremented.
- Create a
- Create a
DelTechclass.- Statically instantiate a
privateArrayListofInstructorobjects calledinstructorList. - Create a
public staticmethod calledhirewhich adds anInstructorto theinstructorListand returnsvoid. - Create a
public staticmethod calledgetInstructorswhich returns theinstructorList. - Create a
public staticmethod calledfireStaffwhich clears ourinstructorList. - Copy and paste this
static initialization blockimmediately below yourinstructorListdeclaration.
- Statically instantiate a
static { // static initializer
String[] instructorNames = { "Brian", "Kaleb", "Zan"};
for (String instructorName : instructorNames) {
Instructor instructor = new Instructor(instructorName);
hire(instructor);
}
}- Create a
TestDelTechclass.-
Create a method named
setupwhich is annotated with@Before, takes has no parameters, and returnsvoid.- Ensure this method invokes the
.fireStaffmethod onDelTech
- Ensure this method invokes the
-
Create a
testFireStaffmethod which ensures that ourinstructorListin ourDelTechclassisEmptyupon invokation. -
Create a
testHireStaffmethod which ensures that ourinstructorListis populated with respectiveInstructorobjects.
-
- Create a
JavaAcademyclass.- Statically instantiate a
privateArrayListofStudentobjects calledstudentList. - Create a
public staticmethod calledrecruitStudentwhich adds aStudentto thestudentListand returnsvoid. - Create a
public staticmethod calledgetStudentswhich returns thestudentList. - Create a
public staticmethod calledremoveStudentswhich clears ourstudentList. - Copy and paste this
static initialization blockimmediately below yourstudentListdeclaration.
- Statically instantiate a
static { // static initializer
String[] studentNames = { "Jessica", "Emad", "Cedric", "Lolu", "Apoorva", "Vara", "Craig", "Robert",
"Stephen", "Ferdinand", "Charu" };
for (String studentName : studentNames) {
Student student = new Student(studentName);
studentList.add(student);
}
}- Create a
TestJavaAcademyclass.-
Create a method named
setupwhich is annotated with@Before, takes has no parameters, and returnsvoid.- Ensure this method invokes the
.removeStudentsmethod onJavaAcademy
- Ensure this method invokes the
-
Create a
testRemoveStudentsmethod which ensures that ourstudentListin ourJavaAcademyclassisEmptyupon invokation. -
Create a
testRecruitStudentmethod which ensures that ourstudentListis populated with respectiveStudentobjects.
-
- Create a
ClassRoomclass.- Statically instantiate a
privateArrayListofStudentobjects calledstudentsby invoking thegetStudentsmethod on theJavaAcademyclass. - Statically instantiate a
privateArrayListofInstructorobjects calledinstructorsby invoking thegetInstructormethod on theDelTechclass. - Create a method named
getRosterwhich returns aHashMappingofStringtoPersonobjects such that ourDelTechinstructors andJavaAcademystudents' names map to their respectivePersonobject.
- Statically instantiate a
- Create a
TestClassRoomclass.- Assert that the
HashMappingreturned bygetRoster, returns avalueSetcontaining each of thePersonobjects inDelTech'sinstructorListandJavaAcademy'sstudentList.# Classroom-OOP
- Assert that the