-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGeorgiaProgrammingContestants.java
53 lines (38 loc) · 1.83 KB
/
GeorgiaProgrammingContestants.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package testing;
import java.util.Iterator;
/**
* Created by robert on 3/14/2015.
*/
public class GeorgiaProgrammingContestants {
GeorgiaSouthernStudents georgiaSouthernStudents = new GeorgiaSouthernStudents(20);
GeorgiaStateStudents georgiaStateStudents = new GeorgiaStateStudents(20);
GeorgiaTechStudents georgiaTechStudents = new GeorgiaTechStudents(20);
PersonIterator southernPersonIterator = georgiaSouthernStudents;
PersonIterator gaStatePersonIterator = georgiaStateStudents;
PersonIterator gaTechPersonIterator = georgiaTechStudents;
public GeorgiaProgrammingContestants(int size){
this.southernPersonIterator = new GeorgiaSouthernStudents(size);
this.gaStatePersonIterator = new GeorgiaStateStudents(size);
this.gaTechPersonIterator = new GeorgiaTechStudents(size);
this.southernPersonIterator = georgiaSouthernStudents;
this.gaStatePersonIterator = georgiaStateStudents;
this.gaTechPersonIterator = georgiaTechStudents;
}
public void listGeorgiaContestants(){
Iterator gaTechStudents = this.gaTechPersonIterator.createIterator();
Iterator gaStateStudents = this.gaStatePersonIterator.createIterator();
Iterator GEORGIA_SOUTHERN_STUDENTS_WOOO = this.southernPersonIterator.createIterator();
System.out.println("\n\nGeorgia Southern Contestants:");
printContestants(GEORGIA_SOUTHERN_STUDENTS_WOOO);
System.out.println("\n\nGeorgia State Contestants:");
printContestants(gaStateStudents);
System.out.println("\n\nGeorgia Tech Contestants");
printContestants(gaTechStudents);
}
public void printContestants(Iterator iterator){
while(iterator.hasNext()){
Person person = (Person)iterator.next();
System.out.println(person.getInfo());
}
}
}