-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathInstructor.java
More file actions
39 lines (30 loc) · 1.02 KB
/
Instructor.java
File metadata and controls
39 lines (30 loc) · 1.02 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
package students.coreyscott;
import java.util.ArrayList;
import java.util.List;
public class Instructor extends Person {
private String department;
private List<Student> students;
public Instructor(int id, String firstName, String lastName, String email,
String department) {
super(id, firstName, lastName, email);
this.department = department;
this.students = new ArrayList<>();
}
public void addStudent(Student student) {
students.add(student);
}
public void printRoster() {
System.out.println(getFullName() + "'s Roster:");
for (Student student : students) {
System.out.println(" - " + student.getFullName());
}
}
public void createAnnouncement(String message) {
System.out.println("Announcement from " + getFullName() + ": " + message);
}
@Override
public String getSummary() {
return "[Instructor]: " + getFullName()
+ " | Department: " + department;
}
}