-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLibraryStaff.cpp
123 lines (97 loc) · 2.75 KB
/
LibraryStaff.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
//LibraryStaff.cpp
//Made by Boyko Michael & Schotkin Maksim
// @@@@ SHOBO @@@@
// ****POWERED BY FRIENDSHIP****
// @@@@*******@@@@
// _____ _ _ ____ ____ ____
// / ____| | | |/ __ \| _ \ / __ \
// | (___ | |__| | | | | |_) | | | |
// \___ \| __ | | | | _ <| | | |
// ____) | | | | |__| | |_) | |__| |
// |_____/|_| |_|\____/|____/ \____/
//Version 1.0
#include <iostream>
#include <stdexcept>
#include <string>
#include "LibraryStaff.h"
using namespace std;
namespace Library {
// Конструктор
LibraryStaff::LibraryStaff()
{
nextSlot = 0;
nextLibrarianID = FirstLibrarianID;
}
// Деструктор
LibraryStaff::~LibraryStaff()
{
// Тут нічого немає
}
Librarian& LibraryStaff::addLibrarian(string librarianName, string librarianJob,
int salary, string gender, int age, string adress,
string passport)
{
if(nextSlot >= MaxLibrarians){
cerr<<"Перевищена максимальна кількість працівників!"<<endl;
throw exception();
}
Librarian& newLibrarian = librarianList[nextSlot++];
newLibrarian.setName(librarianName);
newLibrarian.Hire();
newLibrarian.setWorkerID(nextLibrarianID++);
newLibrarian.setJob(librarianJob);
newLibrarian.setBaseSalary(salary);
newLibrarian.setGender(gender);
newLibrarian.setAge(age);
newLibrarian.setAdress(adress);
newLibrarian.setPassportId(passport);
return newLibrarian;
}
// Пошук біблітекаря за номером
Librarian& LibraryStaff::getLibrarian(int librarianID)
{
for(int i=0;i<nextSlot;i++){
if(librarianList[i].getWorkerID()==librarianID){
return librarianList[i];
}
}
cerr<<"Бібліотекар за номером "<<librarianID<<" не знайден!"<<endl;
throw exception();
}
// Пошук бібліотекаря за ім'ям
Librarian& LibraryStaff::getLibrarian(string librarianName)
{
for(int i=0;i<nextSlot;i++){
if(librarianList[i].getName()==librarianName){
return librarianList[i];
}
}
cerr<<"Бібліотекар за ім'ям "<<librarianName<<" не знайден!"<<endl;
throw exception();
}
// Показати всіх бібліотекарів
void LibraryStaff::displayAll()
{
for(int i=0;i<nextSlot;i++){
librarianList[i].display();
}
}
// Показати найнятих бібліотекарів
void LibraryStaff::displayCurrent()
{
for(int i=0;i<nextSlot;i++){
if(librarianList[i].getHireStatus()){
librarianList[i].display();
}
}
}
// Показати звільнених бібліотекарів
void LibraryStaff::displayFormer()
{
for(int i=0;i<nextSlot;i++){
if(!librarianList[i].getHireStatus()){
librarianList[i].display();
}
}
}
}