-
Notifications
You must be signed in to change notification settings - Fork 0
/
Module.java
154 lines (135 loc) · 3.46 KB
/
Module.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
import java.util.ArrayList;
/**
* The `Module` class represents an academic module with attributes such as
* name, code, credits,
* file name, and a list of enrolled students.
*/
public class Module {
/**
* The name of the module.
*/
private String name;
/**
* The code associated with the module.
*/
private String code;
/**
* The number of credits assigned to the module.
*/
private double credits;
/**
* The name of the file associated with the module.
*/
private String fileName;
/**
* List of student IDs enrolled in the module.
*/
private ArrayList<String> enrolledStudents;
/**
* Constructs a new `Module` object with the given name and code.
*
* @param name The name of the module.
* @param code The code associated with the module.
*/
public Module(String name, String code) {
this.name = name;
this.code = code;
this.enrolledStudents = new ArrayList<>();
}
/**
* Adds a student to the list of enrolled students in the module.
*
* @param id The ID of the student to be added.
*/
public void addStudent(String id) {
enrolledStudents.add(id);
}
/**
* Removes a student from the list of enrolled students in the module.
*
* @param id The ID of the student to be removed.
*/
public void dropStudent(String id) {
enrolledStudents.remove(id);
}
/**
* Returns the name of the module.
*
* @return The name of the module.
*/
public String getName() {
return name;
}
/**
* Sets the name of the module.
*
* @param name The new name of the module.
*/
public void setName(String name) {
this.name = name;
}
/**
* Returns the code associated with the module.
*
* @return The code of the module.
*/
public String getCode() {
return code;
}
/**
* Sets the code associated with the module.
*
* @param code The new code of the module.
*/
public void setCode(String code) {
this.code = code;
}
/**
* Returns the number of credits assigned to the module.
*
* @return The number of credits for the module.
*/
public double getCredits() {
return credits;
}
/**
* Sets the number of credits assigned to the module.
*
* @param credits The new number of credits for the module.
*/
public void setCredits(double credits) {
this.credits = credits;
}
/**
* Returns the name of the file associated with the module.
*
* @return The file name of the module.
*/
public String getFile() {
return fileName;
}
/**
* Sets the name of the file associated with the module.
*
* @param fileName The new file name of the module.
*/
public void setFile(String fileName) {
this.fileName = fileName;
}
/**
* Returns the list of student IDs enrolled in the module.
*
* @return List of enrolled student IDs.
*/
public ArrayList<String> getEnrolledStudents() {
return enrolledStudents;
}
/**
* Sets the list of student IDs enrolled in the module.
*
* @param enrolledStudents The new list of enrolled student IDs.
*/
public void setEnrolledStudents(ArrayList<String> enrolledStudents) {
this.enrolledStudents = enrolledStudents;
}
}