Course.java
1 |
|
2 |
import java.util.List; |
3 |
|
4 |
/** |
5 |
* Course: Represents a course that is a part of a study. |
6 |
* @author Maarten Vangeneugden - 1438256 |
7 |
*/ |
8 |
public class Course { |
9 |
|
10 |
private String name; |
11 |
private int studyPoints; |
12 |
private int semester; |
13 |
private int ID; |
14 |
private boolean pass; |
15 |
private List<Course> requiredCourses; |
16 |
|
17 |
public Course(String name, int studyPoints, int semester, int ID, boolean pass, List<StudyCourse> requiredCourses) { |
18 |
this.name = name; |
19 |
this.studyPoints = studyPoints; |
20 |
this.semester = semester; |
21 |
this.ID = ID; |
22 |
this.pass = pass; |
23 |
this.requiredCourses = requiredCourses; |
24 |
} |
25 |
|
26 |
public void setName(String name) { |
27 |
this.name = name; |
28 |
} |
29 |
public String getName() { |
30 |
return name; |
31 |
} |
32 |
|
33 |
public void setStudyPoints(int studyPoints) { |
34 |
this.studyPoints = studyPoints; |
35 |
} |
36 |
public int getStudyPoints() { |
37 |
return studyPoints; |
38 |
} |
39 |
|
40 |
public void setSemester(int semester) { |
41 |
this.semester = semester; |
42 |
} |
43 |
public int getSemester() { |
44 |
return semester; |
45 |
} |
46 |
|
47 |
public void setID(int ID) { |
48 |
this.ID = ID; |
49 |
} |
50 |
public int getID() { |
51 |
return ID; |
52 |
} |
53 |
|
54 |
public void setPass(boolean pass) { |
55 |
this.pass = pass; |
56 |
} |
57 |
public boolean getPass() { |
58 |
return pass; |
59 |
} |
60 |
|
61 |
public List<Course> getRequiredCourses() { |
62 |
return this.requiredCourses; |
63 |
} |
64 |
public void setRequiredCourses(List<Course> requiredCourses) { |
65 |
this.requiredCourses = requiredCourses; |
66 |
} |
67 |
|
68 |
} |
69 |
|
70 |
class Course { |
71 |
private String m_name; // The name of the course. |
72 |
public String name() { |
73 |
return m_name; |
74 |
} |
75 |
public void setName(String name) { |
76 |
m_name = name; |
77 |
} |
78 |
|
79 |
private int m_studyPoints; // An integer value representing how much study points this course has. |
80 |
public int studyPoints() { |
81 |
return m_studyPoints; |
82 |
} |
83 |
public void setStudyPoints(int studyPoints) { |
84 |
m_studyPoints = studyPoints; |
85 |
} |
86 |
|
87 |
private int m_semester; // Integer that represents in which semester this course takes place. |
88 |
public int semester() { |
89 |
return m_semester; |
90 |
} |
91 |
public void setSemester(int semester) { |
92 |
m_semester = semester; |
93 |
} |
94 |
|
95 |
private int m_ID; // Integer value representing the unique ID of this course. |
96 |
public int ID() { |
97 |
return m_ID; |
98 |
} |
99 |
public void setID(int ID) { |
100 |
m_ID = ID; |
101 |
} |
102 |
|
103 |
private List<Course> m_requiredCourses; // A list of courses that are required to follow this course. |
104 |
public List<Course> requiredCourses() { |
105 |
return m_requiredCourses; |
106 |
} |
107 |
public void setRequiredCourses(List<Course> requiredCourses) { |
108 |
m_requiredCourses = requiredCourses; |
109 |
} |
110 |
|
111 |
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. |
112 |
public boolean creditAcquired() { |
113 |
return m_passed; |
114 |
} |
115 |
public void setPassed(boolean pass) { |
116 |
m_passed = pass; |
117 |
} |
118 |
|
119 |
public Course(String name, int studyPoints, int semester, int ID, boolean pass) { |
120 |
setName(name); |
121 |
setStudyPoints(studyPoints); |
122 |
setSemester(semester); |
123 |
setID(ID); |
124 |
setPassed(pass); |
125 |
} |
126 |
} |
127 |