-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLibrarian.cpp
More file actions
220 lines (138 loc) · 3.53 KB
/
Librarian.cpp
File metadata and controls
220 lines (138 loc) · 3.53 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
//Librarian.cpp
//Made by Boyko Michael & Schotkin Maksim
// @@@@ SHOBO @@@@
// ****POWERED BY FRIENDSHIP****
// @@@@*******@@@@
// _____ _ _ ____ ____ ____
// / ____| | | |/ __ \| _ \ / __ \
// | (___ | |__| | | | | |_) | | | |
// \___ \| __ | | | | _ <| | | |
// ____) | | | | |__| | |_) | |__| |
// |_____/|_| |_|\____/|____/ \____/
//Version 1.2
#include<iostream>
#include "Librarian.h"
using namespace std;
// Конструктор
Librarian::Librarian()
{
id = 0;
name = "Невідомо";
age = 0;
gender = "Невідомо";
adress = "Невідомо";
passportId = "Невідомо";
yearsOfService = 0;
workerSalary = 0;
baseSalary = 12000;
isHired = false;
job = "Немає";
}
// Деструктор
Librarian::~Librarian()
{
//Доки що не потрібен
}
int Librarian::calculateSalary()
{
if(!getHireStatus()){
//Заробітню плату отримують тількі працівники
return 0;
}
//Робітники отримують щорічне підвищення зарплати
return static_cast<int>(getBaseSalary() + (0.05 * getBaseSalary() * getYearsOfService()));
}
int Librarian::getWorkerID(){
return id;
}
void Librarian::setWorkerID(int newID){
if(getHireStatus()){
id = newID;
}
}
string Librarian::getName(){
return name;
}
void Librarian::setName(string newName){
name = newName;
}
int Librarian::getAge(){
return age;
}
void Librarian::setAge(int newAge){
age = newAge;
}
string Librarian::getGender(){
return gender;
}
void Librarian::setGender(string newGender){
gender = newGender;
}
string Librarian::getAdress(){
return adress;
}
void Librarian::setAdress(string newAdress){
adress = newAdress;
}
string Librarian::getPassportId(){
return passportId;
}
void Librarian::setPassportId(string newPassportId){
passportId = newPassportId;
}
int Librarian::getYearsOfService(){
return yearsOfService;
}
void Librarian::setYearsOfService(int newYearsOfService){
yearsOfService = newYearsOfService;
}
int Librarian::getBaseSalary(){
return baseSalary;
}
void Librarian::setBaseSalary(int newBaseSalary){
baseSalary = newBaseSalary;
}
string Librarian::getJob(){
if(getHireStatus()){
return job;
}
return "Немає";
}
void Librarian::setJob(string newJob){
if(getHireStatus()){
job = newJob;
}
}
bool Librarian::getHireStatus(){
return isHired;
}
void Librarian::Hire(){
if (!getHireStatus()){
isHired = true;
job = "В резерві";
}
}
void Librarian::Fire(){
if (getHireStatus()){
isHired = false;
job = "Немає";
id = 0;
}
}
void Librarian::display(){
cout<<"Библіотекар "<<getName()<<endl;
cout<<"**********************"<<endl;
cout<<"Статус: "<<(getHireStatus()?"Найнятий":"Звільнений")<<endl;
if(getHireStatus()){
cout<<"Посада: "<<getJob()<<endl;
cout<<"ID: "<<getWorkerID()<<endl;
cout<<"Заробітна плата: "<<calculateSalary()<<endl;
cout<<"Стаж: "<<getYearsOfService()<<" років"<<endl;
}
cout<<"Стать: "<<getGender()<<endl;
cout<<"Вік: "<<getAge()<<endl;
cout<<"Адреса: "<<getAdress()<<endl;
cout<<"Номер паспорту: "<<getPassportId()<<endl;
cout<<"**********************"<<endl;
cout<<endl;
}