OOP2

Course.java

1
import java.util.List;
2
3
/**
4
 * Course: Represents a course that is a part of a study.
5
 * @author Maarten Vangeneugden - 1438256
6
 */
7
class Course {
8
		private String m_name; // The name of the course.
9
		public String name() {
10
				return m_name;
11
		}
12
		public void setName(String name) {
13
				m_name = name;
14
		}
15
16
		private int m_capacity; // The maximum amount of allowed students.
17
		public int capacity() {
18
			return m_capacity;
19
		}
20
		public void setCapacity(int capacity) {
21
			m_capacity = capacity;
22
		}
23
24
		private int m_studyPoints; // An integer value representing how much study points this course has.
25
		public int studyPoints() {
26
				return m_studyPoints;
27
		}
28
		public void setStudyPoints(int studyPoints) {
29
				m_studyPoints = studyPoints;
30
		}
31
32
		private int m_semester; // Integer that represents in which semester this course takes place.
33
		public int semester() {
34
				return m_semester;
35
		}
36
		public void setSemester(int semester) {
37
				m_semester = semester;
38
		}
39
		
40
		private int m_ID; // Integer value representing the unique ID of this course.
41
		public int ID() {
42
				return m_ID;
43
		}
44
		public void setID(int ID) {
45
				m_ID = ID;
46
		}
47
48
		private List<Course> m_requiredCourses; // A list of courses that are required to follow this course.
49
		public List<Course> requiredCourses() {
50
				return m_requiredCourses;
51
		}
52
		public void setRequiredCourses(List<Course> requiredCourses) {
53
				m_requiredCourses = requiredCourses;
54
		}
55
56
		private boolean m_passed; // A boolean value that holds whether this course has been passed, indicating a credit for it has been acquired by the student.
57
		public boolean creditAcquired() {
58
				return m_passed;
59
		}
60
		public void setPassed(boolean pass) {
61
				m_passed = pass;
62
		}
63
		
64
		public Course(String name, int studyPoints, int semester, int ID, boolean pass) {
65
				setName(name);
66
				setStudyPoints(studyPoints);
67
				setSemester(semester);
68
				setID(ID);
69
				setPassed(pass);
70
		}
71
}
72