69 lines
1.4 KiB
C++
69 lines
1.4 KiB
C++
#include <iostream>
|
|
#include "BankAccount.h"
|
|
using namespace std;
|
|
// TODO: Define public member functions
|
|
string cust_name;
|
|
double checking;
|
|
double savings;
|
|
|
|
|
|
BankAccount::BankAccount(string newName, double amt1, double amt2){
|
|
cust_name = newName;
|
|
checking = amt1;
|
|
savings = amt2;
|
|
}
|
|
|
|
void BankAccount::SetName(string newName){
|
|
cust_name = newName;
|
|
}
|
|
|
|
string BankAccount::GetName(){
|
|
return cust_name;
|
|
}
|
|
|
|
void BankAccount::SetChecking(double amt){
|
|
checking = amt;
|
|
}
|
|
|
|
double BankAccount::GetChecking(){
|
|
return checking;
|
|
}
|
|
void BankAccount::SetSavings(double amt){
|
|
savings = amt;
|
|
}
|
|
|
|
double BankAccount::GetSavings(){
|
|
return savings;
|
|
}
|
|
|
|
void BankAccount::DepositChecking(double amt){
|
|
if (amt>0){
|
|
checking+=amt;
|
|
}
|
|
}
|
|
|
|
void BankAccount::DepositSavings(double amt){
|
|
if (amt>0){
|
|
savings+=amt;
|
|
}
|
|
}
|
|
|
|
void BankAccount::WithdrawChecking(double amt){
|
|
if (amt>0){
|
|
checking-=amt;
|
|
}
|
|
}
|
|
|
|
void BankAccount::WithdrawSavings(double amt){
|
|
if (amt>0){
|
|
savings-=amt;
|
|
}
|
|
}
|
|
|
|
void BankAccount::TransferToSavings(double amt){
|
|
if (amt>0){
|
|
checking -= amt;
|
|
savings += amt;
|
|
}
|
|
}
|