-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTeacher.java
112 lines (96 loc) · 3.15 KB
/
Teacher.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import java.util.*;
public class Teacher {
private String First_Name;
private String Last_name;
private int Number_of_lessons;
private Long Teacher_id;
private List<Course> courses;
private List<Student> studentsOfTeacher;
private List<Assignment> Projects=new ArrayList<>();
Teacher(String First_Name, String Last_name, long Teacher_id) {
this.First_Name = First_Name;
this.Last_name = Last_name;
this.Teacher_id = Teacher_id;
}
public long getTeacherid(){
return Teacher_id;
}
public void setFirst_Name(String first_Name) {
this.First_Name = first_Name;
}
public void addCourse(Course course){
courses.add(course);
course.addteacher(this);
}
public void setLast_name(String last_name) {
this.Last_name = last_name;
}
public void setNumber_of_lessons(int number_of_lessons) {
this.Number_of_lessons = number_of_lessons;
}
public void setCourses(List<Course> courses) {
this.courses = courses;
}
public void ChangeDeadLine(Assignment newAssign , String Newtime){
newAssign.setDeadline(Newtime);
}
public void setStudentsOfTeacher(List<Student> studentsOfTeacher) {
this.studentsOfTeacher = studentsOfTeacher;
}
public void setProjects(List<Assignment> Projects) {
this.Projects = Projects;
}
public String getFirst_Name() {
return First_Name;
}
public String getLast_name() {
return Last_name;
}
public int getNumber_of_lessons() {
return Number_of_lessons;
}
public List<Course> getCourses() {
return courses;
}
public List<Student> getStudentsOfTeacher() {
return studentsOfTeacher;
}
public List<Assignment> getProjects() {
return Projects;
}
public void addStudent(Student student , Course course){
studentsOfTeacher.add(student);
List<Course> c =student.getCourses_Assigned();
if(c.contains(course)){
}
else{
student.addCourse(course, this);
}
for(int i = 0; i<Projects.size() ; i++){
for(int j = 0 ; j<c.size() ; j++){
if(Projects.get(i).getCoursename().equals(c.get(j).getCourseName())){
student.addProjects(Projects.get(i));
break;
}
}
}
}
public void removeStudent(Student student , Course course){
studentsOfTeacher.remove(student);
if(student.getCourses_Assigned().contains(course)){
student.removeCourse(course, this);
}
}
public void addProjects(Assignment x){
Projects.add(x);
for(int j = 0 ; j<studentsOfTeacher.size() ; j++){
studentsOfTeacher.get(j).addProjects(Projects.get(j));
}
}
public void removeProjects(Assignment x){
Projects.remove(x);
for(int j = 0 ; j<studentsOfTeacher.size() ; j++){
studentsOfTeacher.get(j).removeProject(Projects.get(j));
}
}
}