This repository has been archived by the owner on Jun 9, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Lecture.java
81 lines (70 loc) · 1.62 KB
/
Lecture.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
import java.io.Serializable;
/**
* Represents a lecture session of a course.
* A course can have only one lecture session.
* A lecture session can only belong to one course.
* @author Group3
* @version 1.0
*/
public class Lecture implements Session, Serializable {
/**
* Number of vacancies of this lecture.
*/
private int vacancy;
/**
* Size of this lecture.
*/
private int size;
/**
* Id of this lecture.
*/
private int id;
/**
* <code>Lecture</code> constructor.
* Creates a new lecture session with given id and size of this lecture.
* Sets initial vacancies of this lecture equal to size of this lecture.
* @param id id of this lecture
* @param size size of this lecture
*/
public Lecture(int id, int size){
this.id = id;
this.size = size;
this.vacancy = size;
}
/**
* Gets the number of vacancies of this lecture.
* @return the number of vacancies of this lecture
*/
public int getVacancy(){
return vacancy;
}
/**
* Gets the size of this lecture.
* @return the size of this lecture
*/
public int getSize(){
return size;
}
/**
* Gets the id of this lecture.
* @return the id of this lecture
*/
public int getID(){
return id;
}
/**
* Checks if this lecture session is full or not by checking this lecture's vacancy.
* @return A boolean value.
* true if this lecture is full,
* false if this lecture has vacancy
*/
public boolean isFull(){
return vacancy==0;
}
/**
* Reduces the number of vacancies by one when a student registers this lecture session.
*/
public void registered(){
vacancy--;
}
}