-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCourse.java
More file actions
156 lines (130 loc) · 3.76 KB
/
Course.java
File metadata and controls
156 lines (130 loc) · 3.76 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
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
155
156
import java.util.ArrayList;
import java.io.Serializable;;
public class Course implements Serializable {
private static final long serialVersionUID = 1L;
private String title;
private String courseID;
private int maxNumberOfStudents;
private int enrolledStudentNum;
private ArrayList<Student> studentsInCourse;
private String professor;
private int sectionNumber;
private String location;
private String time;
private ArrayList<String> courseInformation = new ArrayList<String>();
public Course(String title, String courseID, int maxNumberOfStudents, int enrolledStudentNum, ArrayList<Student> studentsInCourse, String professor, int sectionNumber, String location, String time) {
//set up all the properties for the object
this.title = title;
this.courseID = courseID;
this.maxNumberOfStudents = maxNumberOfStudents;
this.enrolledStudentNum = enrolledStudentNum;
this.studentsInCourse = studentsInCourse;
this.professor = professor;
this.sectionNumber = sectionNumber;
this.location = location;
this.time = time;
}
//GETTERS
/**
* @return course ID
*/
protected String getCourseID() {
String courseID = this.courseID;
return courseID;
}
/**
* @return course name
*/
protected String getCourseName() {
String courseName = this.title;
return courseName;
}
/**
* @return course section number
*/
protected int getSectionNumber() {
int sectionNum = this.sectionNumber;
return sectionNum;
}
/**
* @return maximum number of students
*/
protected int getMaxNumOfStudents() {
int maxStu = this.maxNumberOfStudents;
return maxStu;
}
/**
* @return number of students enrolled.
*/
protected int getNumOfEnrolledStudents() {
int enrolledStu = this.enrolledStudentNum;
return enrolledStu;
}
/**
* @return ArrayList<Student> of students in course.
*/
protected ArrayList<Student> getListOfStudents() {
ArrayList<Student> listOfStu = this.studentsInCourse;
return listOfStu;
}
/**
* @return an array of course information.
*/
protected ArrayList<String> getCourseInformation() {
this.courseInformation.add(this.title);
this.courseInformation.add(this.courseID);
this.courseInformation.add(this.professor);
this.courseInformation.add(String.valueOf(this.maxNumberOfStudents));
this.courseInformation.add(String.valueOf(this.enrolledStudentNum));
this.courseInformation.add(this.location);
return this.courseInformation;
}
//SETTERS
/**
* Sets maximum number of students.
*/
protected void setMaxNumOfStudents(int maxNumStudents) {
this.maxNumberOfStudents = maxNumStudents;
}
/**
* Sets number of enrolled students.
*/
protected void setNumOfEnrolledStudents(int numEnrolledStudents) {
this.enrolledStudentNum = numEnrolledStudents;
}
/**
* Sets instructor name.
*/
protected void setProfessor(String prof) {
this.professor = prof;
}
/**
* Sets section number.
*/
protected void setSectionNumber(int sectNum) {
this.sectionNumber = sectNum;
}
/**
* Sets course location.
*/
protected void setLocation(String loc) {
this.location = loc;
}
/**
* Sets course time.
*/
protected void setTime(String timeT) {
this.time = timeT;
}
/**
* Prints course information.
*/
protected void printCourseInformation() {
System.out.println("Course Name: " + this.title);
System.out.println("Course ID: " + this.courseID);
System.out.println("Course Instructor: " + this.professor);
System.out.println("Maximum number of students allowed: " + this.maxNumberOfStudents);
System.out.println("Number of students currently enrolled: " + this.enrolledStudentNum);
System.out.println("Course Location: " + this.location);
}
}