-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFaculty.cpp
More file actions
66 lines (54 loc) · 1.55 KB
/
Faculty.cpp
File metadata and controls
66 lines (54 loc) · 1.55 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
#include "Faculty.h"
Faculty::Faculty(int id, string name, string level, string department, DblList<int>* studentIDs){
this->id = id;
this->name = name;
this->level = level;
this->department = department;
this->studentIDs = studentIDs;
}
void Faculty::print(){
cout << "ID: " << id << endl;
cout << "Name: " << name << endl;
cout << "Level: " << level << endl;
cout << "Department: " << department << endl;
cout << name << " is an advisor for the students with the IDS: " << endl;
int data;
int loop = 0;
int firstID;
while(!(studentIDs->isEmpty()) && studentIDs->getFront() != firstID){
data = studentIDs->removeFront();
if(loop == 0){
firstID = data;
}
++loop;
cout << " " << data << endl;
studentIDs->insertBack(data);
}
cout << endl;
}
bool Faculty::operator == (const Faculty& otherFaculty){
return this->id == otherFaculty.id;
}
bool Faculty::operator < (const Faculty& otherFaculty) {
return this->id < otherFaculty.id;
}
bool Faculty::operator > (const Faculty& otherFaculty) {
return this->id > otherFaculty.id;
}
bool Faculty::operator!=(const Faculty& otherFaculty){
return this->id != otherFaculty.id;
}
int Faculty::getID(){
return id;
}
void Faculty::removeStudent(int studentID){
if(studentIDs->find(studentID) != -1){
studentIDs->removeNode(studentID);
}
}
void Faculty::addStudent(int studentID){
studentIDs->insertBack(studentID);
}
Faculty::~Faculty(){
delete studentIDs;
}