aboutsummaryrefslogtreecommitdiff
path: root/CPP/BABS/BankAccount.cpp
diff options
context:
space:
mode:
authorSyndamia <kamen.d.mladenov@protonmail.com>2020-06-27 14:11:01 +0300
committerSyndamia <kamen.d.mladenov@protonmail.com>2020-06-27 14:11:01 +0300
commitf2d1216153123a3fbee6af8e7a0ad06a3577f216 (patch)
tree2c5904a420306a4c742185557f10f158c1d39a1f /CPP/BABS/BankAccount.cpp
parente4bc857f1f7edf677c3ffec8021db57043db350d (diff)
downloadSelf-learning-f2d1216153123a3fbee6af8e7a0ad06a3577f216.tar
Self-learning-f2d1216153123a3fbee6af8e7a0ad06a3577f216.tar.gz
Self-learning-f2d1216153123a3fbee6af8e7a0ad06a3577f216.zip
Finished implementation of closing and opening bank accounts.
Diffstat (limited to 'CPP/BABS/BankAccount.cpp')
-rw-r--r--CPP/BABS/BankAccount.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/CPP/BABS/BankAccount.cpp b/CPP/BABS/BankAccount.cpp
index 180f56c..ea02d87 100644
--- a/CPP/BABS/BankAccount.cpp
+++ b/CPP/BABS/BankAccount.cpp
@@ -14,6 +14,7 @@ BankAccount::BankAccount(int initialDeposit) {
balance = initialDeposit;
}
+
int BankAccount::getId() {
return id;
}
@@ -22,6 +23,11 @@ int BankAccount::getBalance() {
return balance;
}
+bool BankAccount::getCloseStatus() {
+ return closed;
+}
+
+
void BankAccount::deposit(int amount) {
balance += amount;
}
@@ -35,9 +41,13 @@ int BankAccount::withdraw(int amount) {
}
std::string BankAccount::toString() {
- return "ID: " + std::to_string(id) + " Balance: " + std::to_string(balance);
+ return "ID: " + std::to_string(id) + " Balance: " + std::to_string(balance) + ((closed)?" CLOSED":"");
}
void BankAccount::close() {
closed = true;
+}
+
+void BankAccount::reopen() {
+ closed = false;
} \ No newline at end of file