|
|
|
|
118
|
* Create a `test` method which ensures that each of the students in your current cohort are in your `Students` singleton.
|
118
|
* Create a `test` method which ensures that each of the students in your current cohort are in your `Students` singleton.
|
119
|
|
119
|
|
120
|
-
|
120
|
-
|
121
|
-### Part 7.2 - Create `Instructors` singleton
|
|
|
122
|
-* Use `Part 7.0` and `Part 7.1` as a reference.
|
|
|
|
|
121
|
+### Part 8.0 - Create and Test `Instructors` singleton
|
|
|
122
|
+* Use `Part 7` as a reference.
|
123
|
* Create a `Instructors` singleton which represents the set of instructors at ZipCodeWilmington.
|
123
|
* Create a `Instructors` singleton which represents the set of instructors at ZipCodeWilmington.
|
124
|
* Create a `TestInstructors` class.
|
124
|
* Create a `TestInstructors` class.
|
125
|
|
125
|
|
126
|
|
126
|
|
127
|
-### Part 8.1 - Create `ZipCodeWilmington` Class
|
|
|
|
|
127
|
+### Part 9.1 - Create `ZipCodeWilmington` Class
|
128
|
* Use `Part 7` as a reference.
|
128
|
* Use `Part 7` as a reference.
|
129
|
* Create a `ZipCodeWilmington` singleton.
|
129
|
* Create a `ZipCodeWilmington` singleton.
|
130
|
* The class should declare a field that references the instance of `Students` called `students`.
|
130
|
* The class should declare a field that references the instance of `Students` called `students`.
|
|
|
|
|
133
|
* The class should define a method `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.
|
133
|
* The class should define a method `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.
|
134
|
|
134
|
|
135
|
-
|
135
|
-
|
136
|
-# Part 8.0 - Test `ZipCodeWilmington`
|
|
|
|
|
136
|
+### Part 9.0 - Test `ZipCodeWilmington`
|
137
|
* Create a `TestZipCodeWilmington` class.
|
137
|
* Create a `TestZipCodeWilmington` class.
|
138
|
* Create a `testHostLecture` method which ensures that each of the `Student`'s `totalStudyTime` instance variable is incremented by the specified `numberOfHours` upon invoking the `.hostLecture` method.
|
138
|
* Create a `testHostLecture` method which ensures that each of the `Student`'s `totalStudyTime` instance variable is incremented by the specified `numberOfHours` upon invoking the `.hostLecture` method.
|
139
|
|
139
|
|
|
|
|
|
150
|
* You may have noticed that the `findById`, and `hostLecture` methods require an intermediate [casting trick](https://stackoverflow.com/questions/5289393/casting-variables-in-java).
|
150
|
* You may have noticed that the `findById`, and `hostLecture` methods require an intermediate [casting trick](https://stackoverflow.com/questions/5289393/casting-variables-in-java).
|
151
|
* To remedy this issue, we can _generify_ the `People` class.
|
151
|
* To remedy this issue, we can _generify_ the `People` class.
|
152
|
|
152
|
|
153
|
-### Part 9.1 - Modify `People` class
|
|
|
|
|
153
|
+### Part 10.1 - Modify `People` class
|
154
|
* [Parameterize](https://stackoverflow.com/questions/12551674/what-is-meant-by-parameterized-type) the `People` signature to enfore that it is a container for objects of type `E` such that `E` is a subclass of `Person`.
|
154
|
* [Parameterize](https://stackoverflow.com/questions/12551674/what-is-meant-by-parameterized-type) the `People` signature to enfore that it is a container for objects of type `E` such that `E` is a subclass of `Person`.
|
155
|
* Modify `people` field to enforce that is a container of objects of type `E`.
|
155
|
* Modify `people` field to enforce that is a container of objects of type `E`.
|
156
|
* Modify the `add` method to ensure that it handles object of type `E`.
|
156
|
* Modify the `add` method to ensure that it handles object of type `E`.
|
157
|
* Modify the `getArray` method to ensure that it returns an object of type `E[]`.
|
157
|
* Modify the `getArray` method to ensure that it returns an object of type `E[]`.
|
158
|
* Modify the `findById` method to ensure that it returns an object of type `E`.
|
158
|
* Modify the `findById` method to ensure that it returns an object of type `E`.
|
159
|
|
159
|
|
160
|
-### Part 9.2 - Modify `People` subclasses
|
|
|
|
|
160
|
+### Part 10.2 - Modify `People` subclasses
|
161
|
* Modify the `Students` class signature to ensure that it is a subclass of `People` of parameterized type `Student`.
|
161
|
* Modify the `Students` class signature to ensure that it is a subclass of `People` of parameterized type `Student`.
|
162
|
* Modify the `Instructors` class signature to ensure that it is a subclass of `People` of parameterized type `Instructor`.
|
162
|
* Modify the `Instructors` class signature to ensure that it is a subclass of `People` of parameterized type `Instructor`.
|
163
|
|
163
|
|
164
|
-### Part 9.3 - Refactor `ZipCodeWilmington` class
|
|
|
|
|
164
|
+### Part 10.3 - Refactor `ZipCodeWilmington` class
|
165
|
* Refactor the `hostLecture` method in the `ZipCodeWilmington` class by removing any intermediate _casting trick(s)_.
|
165
|
* Refactor the `hostLecture` method in the `ZipCodeWilmington` class by removing any intermediate _casting trick(s)_.
|
166
|
|
166
|
|
167
|
-### Part 9.0 - Test refactored classes.
|
|
|
|
|
167
|
+### Part 10.0 - Test refactored classes.
|
168
|
* Ensure that the `TestStudents`, `TestInstructors`, `TestPeople`, `TestZipCodeWilmington` classes were no affected by the refactor.
|
168
|
* Ensure that the `TestStudents`, `TestInstructors`, `TestPeople`, `TestZipCodeWilmington` classes were no affected by the refactor.
|
169
|
|
169
|
|
170
|
|
170
|
|
|
|
|
|
178
|
Additionally, it's challengaing to ensure **every** `Person` instance has a unique ID amongst its respective `People` subclass.<br>
|
178
|
Additionally, it's challengaing to ensure **every** `Person` instance has a unique ID amongst its respective `People` subclass.<br>
|
179
|
To remedy this issue, we redesign and refactor.
|
179
|
To remedy this issue, we redesign and refactor.
|
180
|
|
180
|
|
181
|
-### Part 9.1 - Create `Educator` enum
|
|
|
|
|
181
|
+### Part 11.1 - Create `Educator` enum
|
182
|
* Create an enum named `Educator`.
|
182
|
* Create an enum named `Educator`.
|
183
|
* The enum should implement `Teacher`.
|
183
|
* The enum should implement `Teacher`.
|
184
|
* The enum should have an enumeration for each of the instructors represented in the `Instructors` class.
|
184
|
* The enum should have an enumeration for each of the instructors represented in the `Instructors` class.
|
185
|
* The enum should have an _empty nullary constructor_.
|
185
|
* The enum should have an _empty nullary constructor_.
|
186
|
|
186
|
|
187
|
-### Part 9.0 - Test `Educator`
|
|
|
|
|
187
|
+### Part 11.0 - Test `Educator`
|
188
|
* Use `Part 5` as a reference.
|
188
|
* Use `Part 5` as a reference.
|
189
|
|
189
|
|
190
|
-### Part 10.1 - Modify `Instructor` Class
|
|
|
|
|
190
|
+### Part 12.1 - Modify `Instructor` Class
|
191
|
* Annotate the constructor with `@Deprecated`.
|
191
|
* Annotate the constructor with `@Deprecated`.
|
192
|
* This constructor should be commented with `//TODO - Remove dependencies`
|
192
|
* This constructor should be commented with `//TODO - Remove dependencies`
|
193
|
* Create a constructor in the `Instructor` class which uses `Educator educator` parameter to set a final `educator` field.
|
193
|
* Create a constructor in the `Instructor` class which uses `Educator educator` parameter to set a final `educator` field.
|
|
|
|
|
195
|
* Remove any calls being made to the deprecated construcor.
|
195
|
* Remove any calls being made to the deprecated construcor.
|
196
|
* Remove the deprecated constructor from the class.
|
196
|
* Remove the deprecated constructor from the class.
|
197
|
|
197
|
|
198
|
-### Part 10.0 - Test `Instructor`
|
|
|
|
|
198
|
+### Part 12.0 - Test `Instructor`
|
199
|
* Refactor `TestInstructor` to support the newly created `Instructor` constructor.
|
199
|
* Refactor `TestInstructor` to support the newly created `Instructor` constructor.
|
200
|
* Ensure the tests were not affected by the refactoring.
|
200
|
* Ensure the tests were not affected by the refactoring.
|