-
Notifications
You must be signed in to change notification settings - Fork 0
/
customer.cpp
79 lines (68 loc) · 1.32 KB
/
customer.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
#include "customer.h"
customer::customer(bool e)
{
existence_ = e;
srand(time(NULL));
difficulty_= rand()%10+5;
loyalty_ = rand()%2;
waitTime_ = 0;
}
customer &customer::operator=(const customer &other)
{
difficulty_ = other.difficulty_;
loyalty_ = other.loyalty_;
waitTime_ = other.waitTime_;
existence_ = other.existence_;
}
customer::customer(const customer &other)
{
difficulty_ = other.difficulty_;
loyalty_ = other.loyalty_;
waitTime_ = other.waitTime_;
existence_ = other.existence_;
}
customer::~customer()
{
existence_ = false;
difficulty_ = 0;
loyalty_ = false;
waitTime_ = 0;
}
int customer::difficulty()
{
return difficulty_;
}
bool customer::loyalty()
{
return loyalty_;
}
void customer::timePassed()
{
waitTime_++;
}
void customer::beingServed()
{
if(difficulty_ > 0)
difficulty_--;
}
int customer::waitTime()
{
return waitTime_;
}
bool operator==(const customer &c1, const customer &c2)
{
if(c1.difficulty_ != c2.difficulty_)
return false;
else if(c1.loyalty_ != c2.loyalty_)
return false;
else if(c1.waitTime_ != c2.waitTime_)
return false;
else if(c1.existence_ != c2.existence_)
return false;
else
return true;
}
bool customer::existence()
{
return existence_;
}