-
Notifications
You must be signed in to change notification settings - Fork 0
/
Student.h
57 lines (45 loc) · 1.35 KB
/
Student.h
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
// Specification file for the Student class
// Written By: Trevor Mathisen
// Changed By:
#ifndef STUDENT_H
#define STUDENT_H
#include<string>
using std::string;
using std::ostream;
class Student; // Forward Declaration
// Function Prototypes for Overloaded Stream Operators
ostream &operator << (ostream &, const Student &);
class Student
{
private:
string stuId; // unique key
string stuName;
string stuPhone;
float stuGpa;
int stuYear;
public:
//constructors
Student();
Student(string, string, string, float , int);
//setters
void setId(string id){ stuId = id;}
void setName(string nm){ stuName = nm;}
void setPhone(string pn){ stuPhone = pn;}
void setGpa(float gpa){ stuGpa = gpa;}
void setYear(int yr){ stuYear = yr;}
//getters
string getId() const { return stuId; }
string getName() const { return stuName; }
string getPhone() const { return stuPhone; }
float getGpa() const { return stuGpa; }
int getYear() const { return stuYear; }
//other functions
void hDdisplay()const;
void vDisplay()const;
// overloaded operators
friend ostream& operator<<(ostream& output, const Student& stu);
bool operator==(const Student& rhs) {return stuId == rhs.getId();}
bool operator<(const Student& rhs) {return stuId < rhs.getId();}
bool operator>(const Student& rhs) {return stuId > rhs.getId();}
};
#endif