-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPerson.cpp
265 lines (263 loc) · 8.19 KB
/
Person.cpp
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
#include <iostream>
#include <string>
#include "Person.h"
using namespace std;
Person::Person(string first, string last, string addr = "", string tel = "") : first_name(first),
last_name(last),
address(addr),
telephone(tel) {}
string Person::get_first_name()
{
return first_name;
}
string Person::get_last_name()
{
return last_name;
}
string Person::get_address()
{
return address;
}
string Person::get_telephone()
{
return telephone;
}
void Person::set_first_name(string first)
{
first_name = first;
}
void Person::set_last_name(string last)
{
last_name = last;
}
void Person::set_address(string addr)
{
address = addr;
}
void Person::set_telephone(string tel)
{
telephone = tel;
}
void Person::print()
{
cout << first_name << ' ' << last_name << endl;
cout << address << endl;
cout << telephone << endl;
}
Student::Student(string first, string last, string addr = "", string tel = "", string promo = "", string group = "", double score = -1) : Person(first, last, addr, tel),
promotion(promo),
tdgroup(group),
gpa(score) {}
string Student::get_promotion()
{
return promotion;
}
string Student::get_tdgroup()
{
return tdgroup;
}
double Student::get_gpa()
{
return gpa;
}
void Student::set_promotion(string promo)
{
promotion = promo;
}
void Student::set_tdgroup(string group)
{
tdgroup = group;
}
void Student::set_gpa(double score)
{
gpa = score;
}
void Student::print()
{
cout << first_name << ' ' << last_name << endl;
cout << address << endl;
cout << telephone << endl;
cout << promotion << endl;
cout << tdgroup << endl;
cout << gpa << endl;
}
Personnel::Personnel(string first, string last, double amount, string addr = "", string tel = "") : Person(first, last, addr, tel),
salary(amount) {}
double Personnel::get_salary()
{
return salary;
}
void Personnel::set_salary(double amount)
{
salary = amount;
}
void Personnel::print()
{
cout << first_name << ' ' << last_name << endl;
cout << address << endl;
cout << telephone << endl;
cout << "salary: " << salary << endl;
}
double Personnel::calculate_salary()
{
return salary;
}
PersonnelAdmin::PersonnelAdmin(string first, string last, double amount, double rate_input, string addr = "", string tel = "", int hours = 0) : Personnel(first, last, amount, addr, tel),
sup_hours(hours),
rate(rate_input) {}
int PersonnelAdmin::get_sup_hours()
{
return sup_hours;
}
double PersonnelAdmin::get_rate()
{
return rate;
}
void PersonnelAdmin::set_sup_hours(int hours)
{
sup_hours = hours;
}
void PersonnelAdmin::set_rate(double rate_input)
{
rate = rate_input;
}
double PersonnelAdmin::calculate_salary()
{
return salary + sup_hours * rate;
}
void PersonnelAdmin::print()
{
cout << first_name << ' ' << last_name << endl;
cout << address << endl;
cout << telephone << endl;
cout << "salary: " << salary << endl;
cout << "supplementary hours: " << sup_hours << endl;
cout << "supplementary work hourly pay: " << rate << endl;
}
PermanentTeacher::PermanentTeacher(string first, string last, double amount, int grade_input, double award_input, string addr = "", string tel = "", string bureau = "") : Personnel(first, last, amount, addr, tel),
grade(grade_input),
award(award_input),
office(bureau) {}
string PermanentTeacher::get_office()
{
return office;
}
int PermanentTeacher::get_grade()
{
return grade;
}
double PermanentTeacher::get_award()
{
return award;
}
void PermanentTeacher::set_office(string bureau)
{
office = bureau;
}
void PermanentTeacher::set_grade(int grade_input)
{
grade = grade_input;
}
void PermanentTeacher::set_award(double award_input)
{
award = award_input;
}
void PermanentTeacher::print()
{
cout << first_name << ' ' << last_name << endl;
cout << address << endl;
cout << telephone << endl;
cout << "salary: " << salary << endl;
cout << "office: " << office << endl;
cout << "grade: " << grade << endl;
cout << "award: " << award << endl;
}
double PermanentTeacher::calculate_salary()
{
return salary + grade * award / 100;
}
TemporaryTeacher::TemporaryTeacher(string first, string last, double amount, string locker_input, double rate_input, string addr = "", string tel = "", int number_hour = 0) : Personnel(first, last, amount, addr, tel),
locker(locker_input),
hour(number_hour),
rate(rate_input) {}
string TemporaryTeacher::get_locker()
{
return locker;
}
int TemporaryTeacher::get_hour()
{
return hour;
}
double TemporaryTeacher::get_rate()
{
return rate;
}
void TemporaryTeacher::set_locker(string locker_input)
{
locker = locker_input;
}
void TemporaryTeacher::set_hour(int hour_input)
{
hour = hour_input;
}
void TemporaryTeacher::set_rate(double rate_input)
{
rate = rate_input;
}
void TemporaryTeacher::print()
{
cout << first_name << ' ' << last_name << endl;
cout << address << endl;
cout << telephone << endl;
cout << "salary: " << salary << endl;
cout << "locker: " << locker << endl;
cout << "number of working hours: " << hour << endl;
cout << "hourly pay: " << rate << endl;
}
double TemporaryTeacher::calculate_salary()
{
return rate * hour;
}
ListPersonnel::ListPersonnel()
{
tab = new Personnel *[100]();
number = 0;
size = 4;
}
void ListPersonnel::add_Personnel(Personnel* ptPersonnel)
{
if (number < size)
{
tab[number] = ptPersonnel;
number++;
}
else
{
doubleSize(tab);
}
}
void ListPersonnel::calculate_salary()
{
for (int i = 0; i < number; i++)
{
cout << "name: " << tab[i]->first_name << ' ' << tab[i]->last_name << endl;
cout << "salary: " << tab[i]->salary << endl;
}
}
Personnel** ListPersonnel::doubleSize(Personnel** &tabl)
{
Personnel** tmp = new Personnel * [2 * size];
for (int i = 0; i <= size; i++)
{
tmp[i] = tabl[i];
}
delete[] tab;
tabl = tmp;
size = 2 * size;
return tmp;
}
int main()
{
Person person();
return 0;
}