-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudent.cpp
More file actions
51 lines (42 loc) · 1.09 KB
/
Student.cpp
File metadata and controls
51 lines (42 loc) · 1.09 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
#include "Student.h"
Student::Student(int id, string name, string level, string major, double gpa, int advisorID){
this->id = id;
this->name = name;
this->level = level;
this->major = major;
this->gpa = gpa;
this->advisorID = advisorID;
}
Student::~Student(){
}
void Student::print(){
cout << "ID: " << id << endl;
cout << "Name: " << name << endl;
cout << "Level: " << level << endl;
cout << "Major: " << major << endl;
cout << "GPA: " << gpa << endl;
if(advisorID != -1){
cout << "Advisor ID: " << advisorID << endl << endl;
}
else{
cout << "No advisor" << endl << endl;
}
}
bool Student::operator == (const Student& otherStudent){
return this->id == otherStudent.id;
}
bool Student::operator < (const Student& otherStudent){
return this->id < otherStudent.id;
}
bool Student::operator!=(const Student& otherStudent){
return this->id != otherStudent.id;
}
int Student::getID(){
return id;
}
int Student::getAdvisor(){
return advisorID;
}
void Student::setAdvisor(int advisorIDnew){
advisorID = advisorIDnew;
}