- 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
ZipCodeWilmingtonclass.- 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 = { "Leon", "Tariq", "Froilan", "David", "Zach", "Iyasu" };
for (String instructorName : instructorNames) {
Instructor instructor = new Instructor(instructorName);
hire(instructor);
}
}- Create a
TestZipCodeWilmingtonclass.-
Create a method named
setupwhich is annotated with@Before, takes has no parameters, and returnsvoid.- Ensure this method invokes the
.fireStaffmethod onZipCodeWilmington
- Ensure this method invokes the
-
Create a
testFireStaffmethod which ensures that ourinstructorListin ourZipCodeWilmingtonclassisEmptyupon invokation. -
Create a
testHireStaffmethod which ensures that ourinstructorListis populated with respectiveInstructorobjects.
-
- Create a
TechConnectclass.- 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 = { "Karen", "Liel", "Quinn", "Destiny", "Blesson", "Danielle B.", "Andre", "Jeff",
"Carlo", "Julia D.", "Natalie", "Julia E.", "Shylee", "Genevieve", "Margo", "Whitney", "Rachel",
"Bridget", "Seung", "Jessica", "Harry", "Kesler", "Darin", "Jade", "Dominika", "Nashae", "Brianna",
"Laurent", "Rina", "Emily", "Elisha", "Caitlin", "Kierra", "Dana", "Alyssa", "Humaira", "Prajwal",
"Cristine", "Brendan" };
for (String studentName : studentNames) {
Student student = new Student(studentName);
studentList.add(student);
}
}- Create a
TestTechConnectclass.-
Create a method named
setupwhich is annotated with@Before, takes has no parameters, and returnsvoid.- Ensure this method invokes the
.removeStudentsmethod onTechConnect
- Ensure this method invokes the
-
Create a
testRemoveStudentsmethod which ensures that ourstudentListin ourTechConnectclassisEmptyupon invokation. -
Create a
testRecruitStudentmethod which ensures that ourstudentListis populated with respectiveStudentobjects.
-
- Create a
ClassRoomclass.- Statically instantiate a
privateArrayListofStudentobjects calledstudentsby invoking thegetStudentsmethod on theTechConnectclass. - Statically instantiate a
privateArrayListofInstructorobjects calledinstructorsby invoking thegetInstructormethod on theZipCodeWilmingtonclass. - Create a method named
getRosterwhich returns aHashMappingofStringtoPersonobjects such that ourZipCodeWilmingtoninstructors andTechConnectstudents' names map to their respectivePersonobject.
- Statically instantiate a
- Create a
TestClassRoomclass.- Assert that the
HashMappingreturned bygetRoster, returns avalueSetcontaining each of thePersonobjects inZipCodeWilmington'sinstructorListandTechConnect'sstudentList.
- Assert that the