-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStudent.h
78 lines (73 loc) · 2.42 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
class Student : public CommuntiyMember {
public:
Student(){
setGPA(5.0);
setCourseLoadHours(100);
}
Student(unsigned long long id, unsigned long long CellPhone, char fname[10], char lname[10], char address[20],double GPAc ,unsigned int CourseLoadHoursc){
CommuntiyMember(id,CellPhone,fname, lname, address);
setGPA(GPAc);
setCourseLoadHours(CourseLoadHoursc);
}
double getGPA(){
return GPA;
}
unsigned int getCourseLoadHours(){
return CourseLoadHours;
}
void setCourseLoadHours(unsigned int CourseLoadHoursx){
CourseLoadHours = CourseLoadHoursx;
}
void setGPA(double GPAx){
GPA = GPAx;
}
virtual void readData(){
cout << "Enter id : ";
cin >> id;
cout << "Enter phone : ";
cin >> CellPhone;
cout << "Enter First name : ";
cin >> fname;
cout << "Enter last name : ";
cin >> lname;
cout << "Enter address: ";
cin >> address;
cout << "Enter GPA: ";
cin >> GPA;
cout << "Enter CourseLoadHours: ";
cin >> CourseLoadHours;
}
void print(){
cout << "ID is : " << getId() << endl;
cout << "Frist name is : " << getFirstName() << endl;
cout << "Last name is : " << getLastName() << endl;
cout << "Cell Phone is : " << getCellPhone() <<endl;
cout << "Address Phone is : " << getAddress() <<endl;
cout << "GPA of student is : "<< getGPA() << endl;
cout << "CourseLoadHours of student is : " << getCourseLoadHours() << endl;
}
virtual string getDataAsString() {
stringstream ss;
ss << "ID is : " << getId() << endl;
ss << "Frist name is : " << getFirstName() << endl;
ss << "Last name is : " << getLastName() << endl;
ss << "Cell Phone is : " << getCellPhone() <<endl;
ss << "Address Phone is : " << getAddress() <<endl;
ss << "GPA of student is : "<< getGPA() << endl;
ss << "CourseLoadHours of student is : " << getCourseLoadHours() << endl;
return ss.str();
}
bool operator==(const Student& other) const {
return this->id == other.id;
}
bool operator!=(const Student& other) const {
return !(*this == other);
}
protected:
double GPA;
unsigned int CourseLoadHours;
};