-
Notifications
You must be signed in to change notification settings - Fork 0
/
teller.cpp
56 lines (48 loc) · 851 Bytes
/
teller.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
#include "teller.h"
teller::teller()
{
srand(time(NULL));
lunch_ = rand() % 120 + 181;
tea_1 = rand() % 165 + 1;
tea_2 = rand() % 165 + 181;
occupied_ = false;
}
teller::teller(int l, int t1, int t2)
{
lunch_ = l;
tea_1 = t1;
tea_2 = t2;
}
teller::teller(const teller &other)
{
lunch_ = other.lunch_;
tea_1 = other.tea_1;
tea_2 = other.tea_2;
}
teller::~teller()
{
lunch_ = tea_1 = tea_2 = 0;
}
bool teller::onDuty(int t)
{
if(t >= tea_1 && t <= tea_1 + 15)
return false;
else if(t >= lunch_ && t <= lunch_ + 30)
return false;
else if(t >= tea_2 && t <= tea_2 + 15)
return false;
else
return true;
}
void teller::occupy()
{
occupied_ = true;
}
void teller::vacate()
{
occupied_ = false;
}
bool teller::occupied()
{
return occupied_;
}