-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSection.java
More file actions
56 lines (53 loc) · 1.06 KB
/
Section.java
File metadata and controls
56 lines (53 loc) · 1.06 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
package com.company;
import java.util.Vector;
public class Section
{
private String ID;
private int totalSeats;
private int seatsOccupied;
Vector<Registration> reg = null;
Course course;
Teacher teacher;
Vector<Attendance> at;
public Section() {}
public Section(String i, int t, int s,Course c)
{
ID = i;
totalSeats = t;
seatsOccupied = s;
course=c;
}
public void setReg(Registration r)
{
reg.add(r);
seatsOccupied++;
}
public String getSectionName()
{
return ID;
}
public int availableSeats()
{
return totalSeats-seatsOccupied;
}
public boolean cancelReg(Registration r)
{
if (reg.remove(r))
{
seatsOccupied--;
return true;
}
return false;
}
public void print()
{
if (totalSeats-seatsOccupied != 0)
{
System.out.println( "Section: " + ID + "\n" );
}
}
public void setTeacher(Teacher e)
{
teacher = e;
}
}