-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomer.h
More file actions
71 lines (58 loc) · 1.75 KB
/
Customer.h
File metadata and controls
71 lines (58 loc) · 1.75 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
#pragma once
#include <iostream>
using namespace std;
class Customer
{
private:
int serviceTime;
int arrivalTime;
string transactionType;
public:
Customer()
{
serviceTime = 0;
arrivalTime = 0;
transactionType = " ";
}
Customer(int arrival_tick)
{
const string alpha[] = {"check deposit",
"cash deposit",
"loan payment",
"transfer",
"withdraval",
"cash a check",
"change order",
"balance inquiry"};
// generates random transaction from array of transactions
transactionType = alpha[rand() % (sizeof(alpha) / sizeof(string))];
arrivalTime = arrival_tick;
// generates real sevice time depending on transaction, in range [1 ... maxService]
serviceTime = 1 + rand() % setMaxService(transactionType);
}
// sets maxService value depending on transaction type
static int setMaxService(string transactionType)
{
int maxService = 0;
if (transactionType.compare("check deposit") == 0)
maxService = 3;
else if (transactionType.compare("cash deposit") == 0)
maxService = 7;
else if (transactionType.compare("loan payment") == 0)
maxService = 10;
else if (transactionType.compare("transfer") == 0)
maxService = 5;
else if (transactionType.compare("withdraval") == 0)
maxService = 6;
else if (transactionType.compare("cash a check") == 0)
maxService = 8;
else if (transactionType.compare("change order") == 0)
maxService = 10;
else if (transactionType.compare("balance inquiry") == 0)
maxService = 2;
return maxService;
}
int getServiceTime() const { return serviceTime; }
int getArrivalTime() const { return arrivalTime; }
string getTransactionType() const { return transactionType; }
};