|
|
7 лет назад | |
|---|---|---|
| .idea | 7 лет назад | |
| src | 7 лет назад | |
| .gitignore | 9 лет назад | |
| .project | 9 лет назад | |
| README.md | 7 лет назад | |
| interfaces-1.iml | 7 лет назад | |
| pom.xml | 9 лет назад |
ZipCodeWilmington class which mediates a composite Students and io.zipcoder.interfaces.Interfaces.Instructors singleton reference.Person ClassPerson class.
final field named id of type long.name of type String.Person constructor should have a parameter of type long which sets the id field to the respective value.getId() method which returns the Person object's id field.getName() method which returns the Person object's name field.setName() method which sets the Person object's name field.-
PersonTestPerson class.
testConstructor method which ensures that a Person object's id field is being set upon construction.testSetName method which ensures that a Person object's name variable is being set by invoking the .setName method.-
Learner InterfaceLearner interface.
Learner should declare one method signature:
learndouble numberOfHoursvoid-
Student ClassStudent class such that:
Student is a subclass of PersonStudent implements the Learner interfaceStudent should have an instance variable totalStudyTime of type doubleStudent should have a concrete implementation of the learn method which increments the totalStudyTime variable by the specified numberOfHours argument.Student should have a getTotalStudyTime() method which returns the totalStudyTime instance variable.-
StudentTestStudent class.
testImplementation method that asserts that a Student is an instanceof a Learner.testInheritance method that asserts that a Student is an instanceof a Person.testLearn method that ensures a Student's totalStudyTime instance variable is incremented by the specified numberOfHours by invoking the .learn method.-
Teacher InterfaceCreate a Teacher interface.
Teacher should declare a teach method signature:
teachLearner learnerdouble numberOfHoursvoidTeacher should declare a lecture method signature:
lectureLearner[] learnersdouble numberOfHoursvoid
-
Instructor ClassInstructor class such that:
Instructor is a subclass of PersonInstructor implements the Teacher interfaceInstructor should have a concrete implementation of the teach method which invokes the learn method on the specified Learner object.Instructor should have a concrete implementation of the lecture method which invokes the learn method on each of the elements in the specified array of Learner objects.
numberOfHours should be evenly split amongst the learners.
double numberOfHoursPerLearner = numberOfHours / learners.length;-
InstructorTestInstructor class.
testImplementation method that asserts that an Instructor is an instanceof a Teacher.testInheritance method that asserts that a Instructor is an instanceof a Person.testTeach method that ensures when an Instructor invokes the teach method, a respective student's totalStudyTime instance variable is incremented by the specified numberOfHours.testLecture method that ensures when an Instructor invokes the lecture method, a respective array of students' totalStudyTime instance variables is incremented by numberOfHours/students.length.-
People classPeople class.
ArrayList field of Person objects named personList.add which adds a Person to the personList.findById which makes use of a long id parameter to return a Person object with the respective id field.remove which makes use of a Person person parameter to remove a respective Person object.remove which makes use of a long id parameter to remove a Person object with the respective id field.getCount which returns the size of personList.getArray which returns an array representation of the personList field.removeAll which clears our personList field.
-
PeopleTestPeople class.
testAdd method which ensures that our personList in our People class populated with respective Person objects following invokation of the add method.testRemove method which ensures that the personList in a People object is depopulated with a respective Person object following the invokation of the remove method.testFindById method which ensures that a respective Person object with a respective id field is returned upon invokation of the findById method on a respective People object.-
Students singletonStudents class.
People class.final field named INSTANCE of type Students.INSTANCE field with respective Student representations of your colleagues.
id field.getInstance method which returns the INSTANCE field.
-
Students singletonTestStudents class.
test method which ensures that each of the students in your current cohort are in your Students singleton.-
io.zipcoder.interfaces.Interfaces.Instructors singletonPart 7 as a reference.io.zipcoder.interfaces.Interfaces.Instructors singleton which represents the set of instructors at ZipCodeWilmington.TestInstructors class.-
ZipCodeWilmington ClassZipCodeWilmington singleton.
Students called students.io.zipcoder.interfaces.Interfaces.Instructors called instructors.hostLecture which makes use of a Teacher teacher, double numberOfHours parameter to host a lecture to the composite people field in the students reference.hostLecture which makes use of a long id, double numberOfHours parameter to identify a respective Instructor to host a lecture to the composite people field in the cohort reference.-
ZipCodeWilmingtonTestZipCodeWilmington class.
testHostLecture method which ensures that each of the Student's totalStudyTime instance variable is incremented by the specified numberOfHours upon invoking the hostLecture method.-
findById, and hostLecture methods require an intermediate casting trick.People class.-
People classPeople signature to enforce that it is a container for objects of type E such that E is a subclass of Person.people field to enforce that is a container of objects of type E.add method to ensure that it handles object of type E.findById method to ensure that it returns an object of type E.getArray method signature by declaring it abstract of return tyoe E.
-
People subclassesStudents class signature to ensure that it is a subclass of People of parameterized type Student.io.zipcoder.interfaces.Interfaces.Instructors class signature to ensure that it is a subclass of People of parameterized type Instructor.getArray method in each of these classes.-
ZipCodeWilmington classhostLecture method in the ZipCodeWilmington class by removing any intermediate casting trick(s).-
TestStudents, TestInstructors, TestPeople, TestZipCodeWilmington classes were not affected by the refactor.-
findById makes it difficult to intuitively identify which Person object is being returned. To remedy this issue, we can make use of an enum which manipulates a composite instructor object.-
Educator enumEducator.
Teacher.io.zipcoder.interfaces.Interfaces.Instructors class.Instructor and assign it to a final instructor field upon construction. The instructor should be added to the io.zipcoder.interfaces.Interfaces.Instructors singleton.teach and lecture method should be differed to the composite instructor reference.double timeWorked field which keeps track of the hours that the Educator has taught.-
EducatorPart 5 as a reference.-
ZipCodeWilmingtonhostLecture method can handle objects of type Educator.