-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBank.h
87 lines (73 loc) · 1.16 KB
/
Bank.h
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
#pragma once
#include <iostream>
using namespace std;
class Bank
{
static double totalbalance;
double balance;
public:
Bank()
{
//cout << "default c-tor!\n";
SetBalance(0);
}
Bank(double b)
{
//cout << "param c-tor!\n";
SetBalance(b);
SetTotalbalance(GetTotalbalance() + b);
}
private:
void SetTotalbalance(double t)
{
totalbalance = t;
}
public:
double GetTotalbalance() const
{
return totalbalance;
}
private:
void SetBalance(double b)
{
if (b < 0) cout << "Îáğàòèòå âíèìàíèå:îòğèöàòåëüíûé áàëàíñ!\n";
balance = b;
}
public:
double GetBalance()const
{
return balance;
}
void GiveKredit(double k)
{
if (balance > k)
{
balance -= k;
totalbalance -= k;
}
}
void ReturnKredit(double k)
{
balance += 1.2 * k;
totalbalance += 1.2 * k;
}
void TakeDepozit(double d)
{
balance += d;
totalbalance += d;
}
void ReturnDepozit(double d)
{
balance -= 1.1 * d;
totalbalance -= 1.1 * d;
}
void PrintBalance()const
{
cout << "Áàëàíñ îäíîãî ôèëèàëà ğàâåí:" << balance << "\n";
}
void PrintTotal()const
{
cout << "Îáùèé áàëàíñ áàíêà ğàâåí:" << totalbalance << "\n";
}
};
double Bank::totalbalance = 1000000;