|
|
|
|
123
|
|
123
|
|
124
|
|
124
|
|
125
|
-
|
125
|
-
|
126
|
-# Part 8.0 - Create `ZipCodeWilmington` Class
|
|
|
127
|
-* Create a `ZipCodeWilmington` class.
|
|
|
128
|
- * _Statically_ instantiate a `private` `ArrayList` of `Instructor` objects named `instructorList`.
|
|
|
129
|
- * Create a `public static` method named `hire` which adds an `Instructor` to the `instructorList` and returns `void`.
|
|
|
130
|
- * Create a `public static` method named `getInstructors` which returns the `instructorList`.
|
|
|
131
|
- * Create a `public static` method named `fireStaff` which clears our `instructorList`.
|
|
|
132
|
- * Copy and paste this `static initialization block` immediately below your `instructorList` declaration.
|
|
|
133
|
-
|
|
|
134
|
-```java
|
|
|
135
|
-static { // static initializer
|
|
|
136
|
- String[] instructorNames = { "Leon", "Tariq", "Froilan", "David", "Zach", "Iyasu" };
|
|
|
137
|
- for (String instructorName : instructorNames) {
|
|
|
138
|
- Instructor instructor = new Instructor(instructorName);
|
|
|
139
|
- hire(instructor);
|
|
|
140
|
- }
|
|
|
141
|
-}
|
|
|
142
|
-```
|
|
|
143
|
-
|
|
|
|
|
126
|
+# Part 8.1 - Create `ZipCodeWilmington` Class
|
|
|
127
|
+* Use `Part 7` as a reference.
|
|
|
128
|
+* Create a `ZipCodeWilmington` singleton.
|
|
|
129
|
+ * The class should declare a field that references `MyCohort` called `cohort`.
|
|
|
130
|
+ * The class should declare a field that references `ZipCodeInstructors` called `instructors`.
|
|
|
131
|
+ * 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.
|
144
|
|
132
|
|
145
|
-
|
133
|
-
|
146
|
-# Part 6.0 - Test `ZipCodeWilmington`
|
|
|
|
|
134
|
+# Part 8.0 - Test `ZipCodeWilmington`
|
147
|
* Create a `TestZipCodeWilmington` class.
|
135
|
* Create a `TestZipCodeWilmington` class.
|
148
|
- * Create a method named `setup` which is annotated with `@Before`, takes has no parameters, and returns `void`.
|
|
|
149
|
- * Ensure this method invokes the `.fireStaff` method on `ZipCodeWilmington`
|
|
|
150
|
-
|
|
|
151
|
- * Create a `testFireStaff` method which ensures that our `instructorList` in our `ZipCodeWilmington` class `isEmpty` upon invokation.
|
|
|
152
|
- * Create a `testHireStaff` method which ensures that our `instructorList` is populated with respective `Instructor` objects.
|
|
|
153
|
-
|
|
|
154
|
--
|
|
|
155
|
-# Part 7.1 - Create `Classroom` Class
|
|
|
156
|
-* Create a `TechConnect` class.
|
|
|
157
|
- * The class should instantiate an `ArrayList` field of `Student` objects named `studentList`.
|
|
|
158
|
- * Create a `public static` method named `recruitStudent` which adds a `Student` to the `studentList` and returns `void`.
|
|
|
159
|
- * Create a `public static` method named `getStudents` which returns the `studentList`.
|
|
|
160
|
- * Create a `public static` method named `removeStudents` which clears our `studentList`.
|
|
|
161
|
- * Copy and paste this `static initialization block` immediately below your `studentList` declaration.
|
|
|
162
|
-
|
|
|
163
|
-```java
|
|
|
164
|
-static { // static initializer
|
|
|
165
|
- String[] studentNames = { "Karen", "Liel", "Quinn", "Destiny", "Blesson", "Danielle B.", "Andre", "Jeff",
|
|
|
166
|
- "Carlo", "Julia D.", "Natalie", "Julia E.", "Shylee", "Genevieve", "Margo", "Whitney", "Rachel",
|
|
|
167
|
- "Bridget", "Seung", "Jessica", "Harry", "Kesler", "Darin", "Jade", "Dominika", "Nashae", "Brianna",
|
|
|
168
|
- "Laurent", "Rina", "Emily", "Elisha", "Caitlin", "Kierra", "Dana", "Alyssa", "Humaira", "Prajwal",
|
|
|
169
|
- "Cristine", "Brendan" };
|
|
|
170
|
- for (String studentName : studentNames) {
|
|
|
171
|
- Student student = new Student(studentName);
|
|
|
172
|
- studentList.add(student);
|
|
|
173
|
- }
|
|
|
174
|
-}
|
|
|
175
|
-```
|
|
|
176
|
-
|
|
|
177
|
-
|
|
|
178
|
--
|
|
|
179
|
-# Part 7.0 - Test `TechConnect`
|
|
|
180
|
-* Create a `TestTechConnect` class.
|
|
|
181
|
- * Create a method named `setup` which is annotated with `@Before`, takes has no parameters, and returns `void`.
|
|
|
182
|
- * Ensure this method invokes the `.removeStudents` method on `TechConnect`
|
|
|
183
|
-
|
|
|
184
|
- * Create a `testRemoveStudents` method which ensures that our `studentList` in our `TechConnect` class `isEmpty` upon invokation.
|
|
|
185
|
- * Create a `testRecruitStudent` method which ensures that our `studentList` is populated with respective `Student` objects.
|
|
|
186
|
-
|
|
|
187
|
--
|
|
|
188
|
-# Part 8.1 - Create `ClassRoom` Class
|
|
|
189
|
-* Create a `ClassRoom` class.
|
|
|
190
|
- * Create a method named `getRoster` which returns a `HashMapping` of `String` to `Person` objects such that our `ZipCodeWilmington` instructors and `TechConnect` students' names map to their respective `Person` object.
|
|
|
191
|
- * Getting started hint below!
|
|
|
192
|
- * instantiate an `ArrayList` of `Student` objects named `students` by invoking the `getStudents` method on the `TechConnect` class.
|
|
|
193
|
- * instantiate an `ArrayList` of `Instructor` objects named `instructors` by invoking the `getInstructor` method on the `ZipCodeWilmington` class.
|
|
|
194
|
-
|
|
|
195
|
--
|
|
|
196
|
-# Part 8.0 - Test `ClassRoom`
|
|
|
197
|
-* Create a `TestClassRoom` class.
|
|
|
198
|
- * Assert that the `HashMapping` returned by `getRoster`, returns a `valueSet` containing each of the `Person` objects in `ZipCodeWilmington`'s `instructorList` and `TechConnect`'s `studentList`.
|
|
|
|
|
136
|
+ * 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.
|