-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCourse.java
69 lines (62 loc) · 1.57 KB
/
Course.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
import java.io.Serializable;
import java.util.ArrayList;
public class Course implements Serializable {
public enum reg_status {active , inactive};
private reg_status status;
private String name, code;
ArrayList<Section> sec_list = new ArrayList<>();
public Course(String name, String code) {
this.name = name;
this.code = code;
}
void createSection(Section s){
sec_list.add(s);
}
Course(){
status = reg_status.inactive;
name = code = "";
sec_list = new ArrayList<Section>();
}
Course(Course c){
status = c.status;
name = c.name;
code = c.code;
sec_list = new ArrayList<Section>(c.sec_list);
}
void set_reg_status(int i){
if(i == 0)
status = reg_status.inactive;
else
status = reg_status.active;
}
void set_name(String n){
name = n;
}
void set_code(String c){
code = c;
}
void set_sec_list(ArrayList<Section> s){
sec_list = new ArrayList<Section>(s);
}
String get_name(){
return name;
}
String get_code(){
return code;
}
ArrayList<Section> get_sec_list(){
return sec_list;
}
reg_status getStatus() {
return status;
}
void displaySections(){
for(int i=0; i<Filing.courseArrayList.size(); i++) {
System.out.println(sec_list.get(i).get_info() + ", ");
Filing.courseArrayList.get(i).displaySections();
}
}
void addSection(Section s){
sec_list.add(s);
}
}