|
@@ -7,14 +7,14 @@ import org.springframework.stereotype.Component;
|
7
|
7
|
import javax.annotation.PostConstruct;
|
8
|
8
|
|
9
|
9
|
@Component
|
10
|
|
-@DependsOn("StudentsConfig")
|
|
10
|
+// @DependsOn("StudentsConfig")
|
11
|
11
|
public class Alumni {
|
12
|
12
|
|
13
|
13
|
private Students alumni;
|
14
|
14
|
private Instructors instructors;
|
15
|
15
|
|
16
|
|
- Alumni(@Autowired Instructors instructors, @Autowired StudentsConfig studentsConfig){
|
17
|
|
- this.instructors = instructors;
|
|
16
|
+ Alumni(@Autowired InstructorsConfig instructorsConfig, @Autowired StudentsConfig studentsConfig){
|
|
17
|
+ this.instructors = instructorsConfig.tcUsaInstructors();
|
18
|
18
|
this.alumni = studentsConfig.previousStudents();
|
19
|
19
|
}
|
20
|
20
|
|
|
@@ -27,13 +27,30 @@ public class Alumni {
|
27
|
27
|
}
|
28
|
28
|
|
29
|
29
|
@PostConstruct
|
30
|
|
- public void executeBootcamp(){
|
31
|
|
- int numberOfHoursPerInstructor = 1200 / instructors.personList.size();
|
32
|
|
- for (Instructor i: instructors) {
|
33
|
|
- i.lecture(alumni, numberOfHoursPerInstructor);
|
|
30
|
+ public void executeBootcamp (){
|
|
31
|
+ try {
|
|
32
|
+ int numOfInstructors = instructors.personList.size();
|
|
33
|
+ int numberOfHoursPerInstructor = 1200 / numOfInstructors;
|
|
34
|
+// for (Instructor i : instructors) {
|
|
35
|
+// i.lecture(alumni, numberOfHoursPerInstructor);
|
|
36
|
+// }
|
|
37
|
+ for (int i = 0; i < numOfInstructors; i++){
|
|
38
|
+ instructors.personList.get(i)
|
|
39
|
+ .lecture(alumni, numberOfHoursPerInstructor);
|
|
40
|
+ }
|
|
41
|
+ } catch (ArithmeticException e){
|
|
42
|
+ throw new ArithmeticException("Cannot divide by zero");
|
34
|
43
|
}
|
35
|
|
-
|
36
|
44
|
}
|
37
|
45
|
|
38
|
|
-
|
39
|
46
|
}
|
|
47
|
+// public void executeBootcamp (){
|
|
48
|
+// if (instructors.personList.size() == 0){
|
|
49
|
+// throw new ArithmeticException("Cannot divide by zero");
|
|
50
|
+// } else {
|
|
51
|
+// int numberOfHoursPerInstructor = 1200 / instructors.personList.size();
|
|
52
|
+// for (Instructor i : instructors) {
|
|
53
|
+// i.lecture(alumni, numberOfHoursPerInstructor);
|
|
54
|
+// }
|
|
55
|
+// }
|
|
56
|
+// }
|