Repository navigation
Expand file tree
/
Copy pathStudent.cpp
More file actions
116 lines (103 loc) · 1.44 KB
/
Copy pathStudent.cpp
File metadata and controls
116 lines (103 loc) · 1.44 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
#include <iostream>
#include "Student.h"
using namespace std;
Student::Student()
{
ID = 0;
Name = " ";
Level = " ";
Major = " ";
GPA = 0;
Advisor = 0;
}
Student::Student(int id, string name, string level, string M, double gpa, int A)
{
ID = id;
Name= name;
Level = level;
Major=M;
GPA=gpa;
Advisor=A;
}
Student::~Student()
{
}
int Student::getID()
{
return ID;
}
string Student::getName()
{
return Name;
}
string Student::getLevel()
{
return Level;
}
void Student::setID(int id)
{
ID = id;
}
void Student::setName(string nm)
{
Name = nm;
}
void Student::setLevel(string lvl)
{
Level = lvl;
}
string Student::getMajor()
{
return Major;
}
double Student::getGPA()
{
return GPA;
}
int Student::getAdvisor()
{
return Advisor;
}
void Student::setMajor(string major)
{
Major = major;
}
void Student::setGPA(double gpa)
{
GPA = gpa;
}
void Student::setAdvisor(int A)
{
Advisor = A;
}
void Student::printAll()
{
cout<<getMajor()<<endl;
cout<<getGPA()<<endl;
cout<<getAdvisor()<<endl;
}
void Student::empty()
{
ID = 0;
Name = " ";
Level = " ";
Major = " ";
GPA = 0;
Advisor = 0;
}
bool Student::operator==(Student &stu)
{
if(ID==stu.getID() && Name==stu.getName() && Level==stu.getLevel() && Major==stu.getMajor()
&& GPA==stu.getGPA())
return true;
else
return false;
}
ostream& operator<<(ostream& os, const Student& stu)
{
os<<stu.Name<<endl;
os<<stu.ID<<endl;
os<<stu.Level<<endl;
os<<stu.Major<<endl;
return os;
}