-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSavingsBankAccount.cpp
43 lines (40 loc) · 1.35 KB
/
SavingsBankAccount.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
// This is a personal academic project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++, C#, and Java: https://pvs-studio.com
//Implementation of SavingsBankAccount Class
#include "BankSystem_Classes.h"
SavingsBankAccount::SavingsBankAccount(double initialBalance,double minimumBalance)
{
if (initialBalance < minimumBalance)
cout << "The Minimum price to create an account is " << minimumBalance<<endl;
else {
cout << "Account has been created\n";
this->minimumBalance = minimumBalance;
setBalance(initialBalance);
setAccounttype("Savings Account");
}
}
double SavingsBankAccount::deposit(double amount)
{
if (amount >= 100){
setBalance(amount+getBalance());
}
else
cout << "Sorry, can't do this - [NOTE] the minimum deposit is "<<minimumBalance<<" LE"<<endl;
return getBalance();
}
double SavingsBankAccount::withdraw(double amount)
{
if ( amount > minimumBalance)
cout << "Sorry, can't do this - [NOTE] the minimum account Balance is "<< minimumBalance<<endl;
else
setBalance(getBalance()-amount);
return getBalance();
}
double SavingsBankAccount::getMinimumBalance()
{
return minimumBalance;
}
void SavingsBankAccount::setMinimumBalance(double amount)
{
minimumBalance = amount;
}