- Create a
Person
class.Person
constructor should have a parameter of typeString
which sets thename
instance-variable to the respective value.Person
should have agetName()
method which returns thePerson
object'sname
variable.Person
should have asetName()
method which sets thePerson
object'sname
variable.
- Create a
TestPerson
class.- Create a
testSetName
method which ensures that aPerson
object'sname
variable is being set by invoking the.setName
method. - Create a
testConstructor
method which ensures that aPerson
object'sname
variable is being set by invoking thePerson
constructor.
- Create a
- Create a
Learner
interface.Learner
should declare one method signature:- Method name:
learn
- Method parameters:
double numberOfHours
- Method return-type:
void
- Method name:
- Create a
Student
class such that:Student
is a subclass ofPerson
Student
implements theLearner
interfaceStudent
should have an instance variabletotalStudyTime
of typedouble
Student
should have a concrete implementation of thelearn
method which increments thetotalStudyTime
variable by the specifiednumberOfHours
argument.Student
should have agetTotalStudyTime()
method which returns thetotalStudyTime
instance variable.
- Create a
TestStudent
class.- Create a
testImplementation
method that asserts that aStudent
is aninstanceof
aLearner
. - Create a
testInheritance
method that asserts that aStudent
is aninstanceof
aPerson
. - Create a
testLearn
method that ensures aStudent
'stotalStudyTime
instance variable is incremented by the specifiednumberOfHours
by invoking the.learn
method.
- Create a
- Create a
Teacher
interface.-
Teacher
should declare ateach
method signature:- Method name:
teach
- Method parameters:
Student student
double numberOfHours
- Method return-type:
void
- Method name:
-
Teacher
should declare alecture
method signature:- Method name:
lecture
- Method parameters:
Student[] student, double numberOfHours
- Method return-type:
void
- Method name:
-
- Create an
Instructor
class such that:Instructor
is a subclass ofPerson
Instructor
implements theTeacher
interfaceInstructor
should have a concrete implementation of theteach
method which invokes thelearn
method on the specifiedStudent
object.Instructor
should have a concrete implementation of thelecture
method which invokes thelearn
method on the specified array ofStudent
objects.numberOfHours
should be evenly split amongst the students.double numberOfHoursPerStudent = numberOfHours / students.length;
- Create an
TestInstructor
class.- Create a
testImplementation
method that asserts that anInstructor
is aninstanceof
aTeacher
. - Create a
testInheritance
method that asserts that aInstructor
is aninstanceof
aPerson
. - Create a
testTeach
method that ensures when anInstructor
invokes the.teach
method, a respective student'stotalStudyTime
instance variable is incremented. - Create a
testLecture
method that ensures when anInstructor
invokes the.teach
method, a respective student'stotalStudyTime
instance variable is incremented.
- Create a
- Create a
ZipCodeWilmington
class.- Statically instantiate a
private
ArrayList
ofInstructor
objects calledinstructorList
. - Create a
public static
method calledhire
which adds anInstructor
to theinstructorList
and returnsvoid
. - Create a
public static
method calledgetInstructors
which returns theinstructorList
. - Create a
public static
method calledfireStaff
which clears ourinstructorList
. - Copy and paste this
static initialization block
immediately below yourinstructorList
declaration.
- 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
TestZipCodeWilmington
class.-
Create a method named
setup
which is annotated with@Before
, takes has no parameters, and returnsvoid
.- Ensure this method invokes the
.fireStaff
method onZipCodeWilmington
- Ensure this method invokes the
-
Create a
testFireStaff
method which ensures that ourinstructorList
in ourZipCodeWilmington
classisEmpty
upon invokation. -
Create a
testHireStaff
method which ensures that ourinstructorList
is populated with respectiveInstructor
objects.
-
- Create a
TechConnect
class.- Statically instantiate a
private
ArrayList
ofStudent
objects calledstudentList
. - Create a
public static
method calledrecruitStudent
which adds aStudent
to thestudentList
and returnsvoid
. - Create a
public static
method calledgetStudents
which returns thestudentList
. - Create a
public static
method calledremoveStudents
which clears ourstudentList
. - Copy and paste this
static initialization block
immediately below yourstudentList
declaration.
- 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", "Blesson", "Brendan" };
for (String studentName : studentNames) {
Student student = new Student(studentName);
studentList.add(student);
}
}
- Create a
TestTechConnect
class.-
Create a method named
setup
which is annotated with@Before
, takes has no parameters, and returnsvoid
.- Ensure this method invokes the
.removeStudents
method onTechConnect
- Ensure this method invokes the
-
Create a
testRemoveStudents
method which ensures that ourstudentList
in ourTechConnect
classisEmpty
upon invokation. -
Create a
testRecruitStudent
method which ensures that ourstudentList
is populated with respectiveStudent
objects.
-
- Create a
ClassRoom
class.- Statically instantiate a
private
ArrayList
ofStudent
objects calledstudents
by invoking thegetStudents
method on theTechConnect
class. - Statically instantiate a
private
ArrayList
ofInstructor
objects calledinstructors
by invoking thegetInstructor
method on theZipCodeWilmington
class. - Create a method named
getRoster
which returns aHashMapping
ofString
toPerson
objects such that ourZipCodeWilmington
instructors andTechConnect
students' names map to their respectivePerson
object.
- Statically instantiate a
- Create a
TestClassRoom
class.- Assert that the
HashMapping
returned bygetRoster
, returns avalueSet
containing each of thePerson
objects inZipCodeWilmington
'sinstructorList
andTechConnect
'sstudentList
.
- Assert that the