-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAccountImpl.cpp
More file actions
99 lines (78 loc) · 1.37 KB
/
AccountImpl.cpp
File metadata and controls
99 lines (78 loc) · 1.37 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
#include "AccountImpl.h"
#include "Account.h"
#include <string>
#include <iostream>
using namespace std;
/*****************
* CTORs and DTORs
*****************/
AccountImpl::AccountImpl(Account_Type type,float percent, int date, Period period, int id)
{
this->id = id;
this->type = type;
this->percent = percent;
this->date = date;
this->period = period;
closed = false;
this->amount = 0;
lastMsg = "There is no messages from the bank";
}
AccountImpl::~AccountImpl(){
cout << "Account " << id << " deleted";
}
float AccountImpl::GetPrecent() const
{
return percent;
}
/*********************
* Member functions
*********************/
int AccountImpl::GetDate() const
{
return date;
}
Period AccountImpl::GetPeriod() const
{
return period;
}
std::string AccountImpl::GetLastMsg() const
{
return lastMsg;
}
bool AccountImpl::IsClosed() const
{
return closed;
}
void AccountImpl::deposit( int sum )
{
amount += sum;
}
float AccountImpl::withdraw( int sum )
{
float tmp;
//case withdrawal grater then the amount in the account
if(amount < sum){
tmp = amount;
amount = 0;
}else{
tmp = (float)sum;
amount -= sum;
}
return tmp;
}
void AccountImpl::Notify( string msg )
{
lastMsg = msg;
}
int AccountImpl::GetAccountType() const
{
return type;
}
float AccountImpl::getAmount() const
{
return amount;
}
int AccountImpl::GetId() const
{
return id;
}