-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathMain.java
More file actions
46 lines (34 loc) · 1.29 KB
/
Main.java
File metadata and controls
46 lines (34 loc) · 1.29 KB
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
package students.jordaneldridge.maxxblue;
import java.util.ArrayList;
import java.util.List;
public class Main {
public static void main(String[] args) {
// Students
Student jordan = new Student("S1", "Jordan", "Smith", "jordan@school.edu", 2, 3.8);
Student marcus = new Student("S2", "Marcus", "Brown", "marcus@school.edu", 1, 2.9);
// Instructor
Instructor rivera = new Instructor("I1", "Dr.", "Rivera", "rivera@school.edu", "Computer Science");
// Assign roster
rivera.addStudent(jordan);
rivera.addStudent(marcus);
rivera.printRoster();
List<Person> people = new ArrayList<>();
people.add(jordan);
people.add(marcus);
people.add(rivera);
System.out.println();
for (Person p : people) {
// Polymorphism: calls the correct overridden getSummary()
System.out.println(p.getSummary());
}
System.out.println();
// Stretch goal usage
School school = new School();
school.addStudent(jordan);
school.addStudent(marcus);
school.addInstructor(rivera);
school.printDirectory();
System.out.println();
rivera.createAnnouncement("Quiz on Friday. Study inheritance and overriding!");
}
}