-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.h
More file actions
125 lines (92 loc) · 2.55 KB
/
client.h
File metadata and controls
125 lines (92 loc) · 2.55 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
#include "people.h"
#include <iostream>
#include <string.h>
#include <cstdlib>
#include <ctime>
#ifndef BANKINGPROJECT_CLIENT_H
#define BANKINGPROJECT_CLIENT_H
using namespace std;
class Client : public People{
public:
Client();
Client(string client_name);
~Client() { }
string getClientName() const;
int getExternalpartnerId() const;
double getBankAccountNumber() const;
int setBalance(int amount);
int setAccountNumber(uint32_t number);
bool removeAccount(string name);
int generateReferenceNumber() const;
int askRecommendationNumber(Client& client);
bool agreeingToReccommendation();
int setRecommendationNumber(int number);
int getRecommendationNumber() const;
void setNetWorth(int amount);
int getNetWorth() const;
void addNetWorth(int amount);
void deductNetWorth(int amount);
private:
string clientName;
uint32_t bankAccountNumber;
int externalPartnerId;
int referenceNumber;
int networth;
};
Client::Client() {
this->clientName = "";
srand(time(NULL));
this->bankAccountNumber = 0;
this->externalPartnerId = 0;
this->referenceNumber= 0;
}
Client::Client(string name) {
this->clientName = name;
this->referenceNumber = 0;
this->bankAccountNumber = 0;
this->externalPartnerId = 0;
srand(time(NULL));
}
string Client::getClientName() const {
return this->clientName;
}
int Client::getExternalpartnerId() const {
return this->externalPartnerId;
}
int Client::setRecommendationNumber(int number) {
this->referenceNumber = number;
return 1;
}
bool Client::agreeingToReccommendation() {
return true;
}
int Client::generateReferenceNumber() const {
return ((rand()%2000) + 1000);
}
void Client::addNetWorth(int amount) {
this->netWorth += amount;
}
void Client::deductNetWorth(int amount) {
this->netWorth -=amount;
}
int Client::getRecommendationNumber() const {
return this->referenceNumber;
}
int Client::askRecommendationNumber(Client& client) {
if (this->getClientName() == client.getClientName()) {
cout << "Self recommendation is not allowed." << endl;
return 1;
}
int token = client.generateReferenceNumber();
this->setRecommendationNumber(token);
client.setRecommendationNumber(token);
//cout << "Recomendation number: " << client.getRecommendationNumber() << endl;
return 0;
}
void Client::setNetWorth(int amount) {
this->netWorth = amount;
}
int Client::getNetWorth() const {
return this->netWorth;
}
#endif //BANKINGPROJECT_CLIENT_H