-
Notifications
You must be signed in to change notification settings - Fork 0
/
Courses.java
162 lines (131 loc) · 4.43 KB
/
Courses.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
import java.util.*;
public class Courses {
private int id;
private String name;
private ArrayList<Program> programs= new ArrayList<Program>();
private ArrayList<CLO> clos= new ArrayList<CLO>();
private ArrayList<Teacher> teachers = new ArrayList<Teacher>();
private int creditHours;
public void printCourses() {
System.out.println("ID: "+id);
System.out.println("Title: "+name);
System.out.println("Credit Hours: "+creditHours);
if(programs!=null) {
for (int i = 0; i < programs.size(); i++)
System.out.print("programs " + programs.get(i).getId() + " ");
System.out.print(" ||| " );
}
if(programIds!=null) {
for (int i = 0; i < programIds.size(); i++)
System.out.print("programids " + programIds.get(i)+ " ");
}
System.out.println();
if(clos!=null) {
for (int i = 0; i < clos.size(); i++)
System.out.print("CLO " + clos.get(i).getId() + " ");
System.out.print(" ||| " );
}
if(cloIds!=null) {
for (int i = 0; i < cloIds.size(); i++)
System.out.print("CLOIds " + cloIds.get(i)+ " ");
}
System.out.println();
if(teachers!=null) {
for (int i = 0; i < teachers.size(); i++)
System.out.print("teachers " + teachers.get(i).getId() + " ");
System.out.print(" ||| " );
}
if(teacherIds!=null) {
for (int i = 0; i < teacherIds.size(); i++)
System.out.print("teacherIds " + teacherIds.get(i)+ " ");
}
System.out.println('\n');
}
//filing params
private ArrayList<Integer> programIds= new ArrayList<Integer>();
private ArrayList<Integer> cloIds= new ArrayList<Integer>();
private ArrayList<Integer> teacherIds= new ArrayList<Integer>();
//constructor
public Courses(int id, String name, ArrayList<Program> programs, ArrayList<CLO> clos, ArrayList<Teacher> teachers,int creditHours,ArrayList<Integer> programIds,ArrayList<Integer> cloIds,ArrayList<Integer> teacherIds) {
this.id = id;
this.name = name;
this.programs = programs;
this.clos = clos;
this.teachers=teachers;
this.creditHours = creditHours;
this.programIds=programIds;
this.cloIds=cloIds;
this.teacherIds=teacherIds;
}
public void assignCLO(CLO clo) {
if(!clos.contains(clo)) {
if(this.clos==null)
this.clos=new ArrayList<>();
if(this.cloIds==null)
this. cloIds=new ArrayList<>();
this.clos.add(clos.size(), clo);
this.cloIds.add(clo.getId());
}
else System.out.println("You are trying to assign same CLO again");
}
public void setTeachers(ArrayList<Teacher> teachers) {
this.teachers = teachers;
}
public void setCloIds(ArrayList<Integer> cloIds) {
this.cloIds = cloIds;
}
public void setTeacherIds(ArrayList<Integer> teacherIds) {
this.teacherIds = teacherIds;
}
public ArrayList<Teacher> getTeachers() {
return teachers;
}
public ArrayList<Integer> getCloIds() {
return cloIds;
}
public ArrayList<Integer> getTeacherIds() {
return teacherIds;
}
public ArrayList<Program> getPrograms() {
return programs;
}
public void setPrograms(ArrayList<Program> programs) {
this.programs = programs;
}
public void setProgramIds(ArrayList<Integer> programIds) {
this.programIds = programIds;
}
public ArrayList<Integer> getProgramIds() {
return programIds;
}
public void setClosIds(ArrayList<Integer> closIds) {
this.cloIds = closIds;
}
public ArrayList<Integer> getClosIds() {
return cloIds;
}
public int getId() {
return id;
}
public String getName() {
return name;
}
public ArrayList<CLO> getClos() {
return clos;
}
public int getCreditHours() {
return creditHours;
}
public void setId(int id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
public void setClos(ArrayList<CLO> clos) {
this.clos = clos;
}
public void setCreditHours(int creditHours) {
this.creditHours = creditHours;
}
}