-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLecture.java
More file actions
103 lines (86 loc) · 2.79 KB
/
Copy pathLecture.java
File metadata and controls
103 lines (86 loc) · 2.79 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
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
import java.util.ArrayList;
class Lecture {
private String crn;
private String prefix;
private String lectureName;
private LectureType lectureType; //Grad or UnderGrad
private LectureMode lectureMode; //F2F, Mixed or Online
private String classroom;
private boolean hasLabs;
private int creditHours;
ArrayList<Lab> labs;
// _________________
//Helper method-used in constructors to set up the common fields
private void LectureCommonInfoSetUp (String crn, String prefix, String lectureName, LectureType lectureType, LectureMode lectureMode) {
this.crn = crn;
this.prefix = prefix;
this.lectureName = lectureName;
this.lectureType = lectureType;
this.lectureMode = lectureMode;
}
// Non-online with Labs
public Lecture(String crn, String prefix, String lectureName, LectureType lectureType, LectureMode lectureMode, String classroom, boolean hasLabs, int creditHours, ArrayList<Lab> labs) {
LectureCommonInfoSetUp(crn,prefix,lectureName,lectureType,lectureMode);
this.classroom = classroom;
this.hasLabs = hasLabs;
this.creditHours = creditHours;
this.labs = labs;
}
// Constructor for Non-online without Labs
public Lecture( String crn, String prefix, String lectureName, LectureType lectureType, LectureMode lectureMode, String classroom, boolean hasLabs, int creditHours) {
LectureCommonInfoSetUp(crn,prefix,lectureName,lectureType,lectureMode);
this.classroom = classroom;
this.hasLabs = hasLabs;
this.creditHours = creditHours;
}
// Constructor for Online Lectures
public Lecture(String crn, String prefix, String lectureName, LectureType lectureType, LectureMode lectureMode, int creditHours) {
LectureCommonInfoSetUp(crn,prefix,lectureName,lectureType,lectureMode);
this.classroom = classroom;
this.hasLabs = hasLabs;
this.creditHours = creditHours;
}
public String getCrn() {
return crn;
}
public String getPrefix() {
return prefix;
}
public String getLectureName() {
return lectureName;
}
public LectureType getLectureType() {
return lectureType;
}
public LectureMode getLectureMode() {
return lectureMode;
}
public String getClassroom() {
return classroom;
}
public boolean getHasLabs() {
return hasLabs;
}
public int getCreditHours() {
return creditHours;
}
public void setHasLabs(boolean hasLabs){
this.hasLabs = hasLabs;
}
//________
@Override
public String toString() {
String yesNo = hasLabs ? "YES" : "NO";
String lectureAndLabs = crn + "," + prefix + "," + lectureName + "," + lectureType + "," + lectureMode;
if(lectureMode != LectureMode.ONLINE){
lectureAndLabs += "," + classroom;
}
lectureAndLabs += "," + yesNo + ","+ creditHours+"\n";
if ( labs != null ) {//printing corresponding labs
//lectureAndLabs+="\n";
for (Lab lab: labs)
lectureAndLabs+= lab +"\n";
}
return lectureAndLabs;
}
}