-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudent.cpp
More file actions
185 lines (159 loc) · 4.48 KB
/
Copy pathStudent.cpp
File metadata and controls
185 lines (159 loc) · 4.48 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
/*
Derek Norman
2364922
norman@chapman.edu
CPSC-350-03
Assignment 6
Using two late days for this assignment!
*/
/*
* Student class representing a simple Student in a database
*/
#include "Student.h"
Student::Student(){ //constructor
m_studentID = 0;
m_name = "";
m_level = "";
m_major = "";
m_GPA = 0.0;
m_advisorID = 0;
}
Student::Student(int studentID, string studentName, string studentLevel, string studentMajor, double studentGPA, int advisorID){ //overloaded constructor
m_studentID = studentID;
m_name = studentName;
m_level = studentLevel;
m_major = studentMajor;
m_GPA = studentGPA;
m_advisorID = advisorID;
}
Student::~Student(){ //destructor
}
/*
* Method getID, gets the ID number of the student
* returns an int representing the student ID
*/
int Student::getID(){
return m_studentID;
}
/*
* method setStudentID, sets the students ID number
* Takes a single paramter ID representing the student ID to be set
*/
void Student::setID(int id){
m_studentID = id;
}
/*
* Method getStudentName, returns the name of the student
* returns a string representing the name of the student
*/
string Student::getStudentName(){
return m_name;
}
/*
* Method setStudentName, sets the name of the student
* takes a single string parameter, studentName, representing the name of the student
*/
void Student::setStudentName(string studentName){
m_name = studentName;
}
/*
* Method getStudentLevel, returns the level of the student
* returns a string representing the level of the student
*/
string Student::getStudentLevel(){
return m_level;
}
/*
* Method setStudentLevel, sets the level of the student
* Takes single string parameter, studentLevel, representing the level of the student
*/
void Student::setStudentLevel(string studentLevel){
m_level = studentLevel;
}
/*
* Method getStudentMajor, returns the major of the student
* returns a string representing the major of the student
*/
string Student::getStudentMajor(){
return m_major;
}
/*
* Method setStudentMajor, sets the students major
* takes a single parameter of type string, studentMajor, representing the major of the student
*/
void Student::setStudentMajor(string studentMajor){
m_major = studentMajor;
}
/*
* Method getStudentGPA, returns the gpa of the student
* returns a double representing the gpa of the student
*/
double Student::getStudentGPA(){
return m_GPA;
}
/*
* Method setStudentGPA, sets the students gpa
* takes single parameter of type double, studentGPA, representing the students gpa
*/
void Student::setStudentGPA(double studentGPA){
m_GPA = studentGPA;
}
/*
* Method getAdvisorID, returns the faculty ID of the students advisor
* returns an int representing the ID of the students advisor
*/
int Student::getAdvisorID(){
return m_advisorID;
}
/*
* Method setAdvisorID, sets the students advisor ID
* takes a single parameter of type int, advisorID, representing the ID of the students advisor
*/
void Student::setAdvisorID(int advisorID){
m_advisorID = advisorID;
}
/*
* method equalTo, checks if a student is equal to another student
* Takes single parameter other, representing the other student
* Returns a bool representing whether or not the students are equal
*/
bool Student::equalTo(Student *other){
if(m_studentID == other->getID()){
return true;
}
return false;
}
/*
* method lessThan, checks if a student id is less than another students id
* Takes a single paramter other, representing the other student
* Returns a bool representing whether or not the students id is less than the other students id
*/
bool Student::lessThan(Student *other){
if(m_studentID < other->getID()){
return true;
}
return false;
}
/*
* method greaterThan, checks if a student id is greater than another students id
* Takes a single paramter other, representing the other student
* Returns a bool representing whether or not the students id is greater than the other students id
*/
bool Student::greaterThan(Student *other){
if(m_studentID > other->getID()){
return true;
}
return false;
}
/*
* method Print, prints a visual representation of the Student
*/
void Student::Print(){
cout << "[ Student Name: " << m_name << ", " << endl;
cout << "Student ID: " << m_studentID << ", " << endl;
cout << "Level: " << m_level << ", " << endl;
cout << "Major: " << m_major << ", " << endl;
cout << "GPA: " << m_GPA << ", " << endl;
cout << "advisor ID: " << m_advisorID << " ], " << endl;
cout << endl;
}