-
Notifications
You must be signed in to change notification settings - Fork 0
/
account.cpp
57 lines (41 loc) · 1.05 KB
/
account.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
#include "account.h"
account::account() : password(""), balance(0), id(0) {
}
const int &account::Get_id() const {
return id;
}
const int &account::Get_balance() const {
return balance;
}
const std::string &account::Get_user_name() const {
return user_name;
}
const std::string &account::Get_password() const {
return password;
}
void account::Set_balance(int balance) {
this->balance = balance;
}
void account::Set_password(std::string password) {
this->password = password;
}
void account::Set_user_name(std::string user_name) {
this->user_name = user_name;
}
void account::Add_balance(int value) {
balance += value;
}
const bool account::available_to_use(int &value) const {
return balance >= value;
}
void account::Reduse_balance(int value) {
balance -= value;
}
void account::PrintInfo() {
std::cout << "\n";
std::cout << "user name : " << Get_user_name() << '\t' << "ID : " << Get_id() << '\n';
std::cout << "Balance : " << Get_balance() << '\n';
}
void account::Set_id(int id) {
this->id = id;
}