Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++: Banking Project Design and implement a hierarchy inheritance system of bank

ID: 3920671 • Letter: C

Question

C++: Banking Project Design and implement a hierarchy inheritance system of banking, which includes Savings and Checking accounts of a customer. Inheritance and virtual functions must be used and applied.

The following features must be incorporated:

1. The account must have an ID and customer’s full name and his/her social security number.

2. General types of banking transactions for both accounts, Checking and Savings: withdraw, deposit, calculate interest (based on the current balance, and if it was not modified, there will be no new interest), figure out the balance, and transfer funds (between the two accounts, from Checking to Savings and vice versa).

3. Savings restrictions:

Become inactive if the balance falls less than $25, and under such situation, no more withdrawals may be allowed.

A $1 charge for each transfer fund (to Checking account), with the first transfer is free.

The monthly interest rate is 3.75%.

4. Checking restrictions:

A monthly service charge is $5 (automatically be charged when Checking account was opened).

A 10 cents charge for each written check, with the first check is free.

A $15 charge for each bounced check (not enough funds).

The monthly interest rate is 2.5%.

Explanation / Answer

#include<iostream>

#include<string>

using namespace std;

class account {

public:

virtual void withdraw(double amount) {}

virtual void deposit(double amount) {}

virtual double calcInterest()=0;

virtual double checkBalance()=0;

virtual void transferFund(){}

account(int id,string name,string ssn) :ID(id),fullname(name),ssn(ssn)

{}

account() {}

protected:

double balance;

private:

int ID;

string fullname;

string ssn;

};

class SavingAccount : public account {

public:

void withdraw(double amount) {

if (amount > checkBalance()) {

cout << "Don't have sufficient balance ";

}

else {

balance -= amount;

if (balance < 25)

accActive = false;

}

}

void deposit(double amount) {

balance += amount;

}

double calcInterest() {

return balance * 3.75 / 12;

}

double checkBalance() {

return balance;

}

template <class T>

void transferFund(double amount, T &t) {

if (firstTransaction && amount <= balance) {

balance -= amount;

t.deposit(amount);

if (balance < 25)

accActive = false;

}

}

SavingAccount(int id, string name, string ssn) : account(id, name, ssn)

{}

SavingAccount() {}

private:

//A $1 charge for each transfer fund (to Checking account), with the first transfer is free.

bool accActive=true; //inactive if the balance falls less than $25

double interest=3.75;

bool firstTransaction = true;

};

class CheckingAccount : public account {

public:

void withdraw(double amount) {

if (amount <= balance) {

balance -= amount;

}

}

void deposit(double amount) {

balance += amount;

}

double calcInterest() {

return balance * interest / 12;

}

double checkBalance() {

return balance;

}

template <class T>

void transferFund(double amount, T &t) {

if (firstCheck && amount <= balance) {

balance -= amount;

t.deposit(amount);

} else if(amount <= balance - checkCharge) {

balance -= (amount + checkCharge);

} else {

balance -= checkBounceCharge;

}

}

CheckingAccount(int id, string name, string ssn): account(id,name,ssn)

{}

CheckingAccount() {}

public:

double monthlyServiceCharge = 5;

/*A 10 cents charge for each written check, with the first check is free.

A $15 charge for each bounced check(not enough funds).

The monthly interest rate is 2.5%.*/

bool firstCheck = true;

double checkCharge = .1;

double checkBounceCharge = 15;

double interest = 3.75;

};

int main()

{

account *A = new SavingAccount(1,"sitaram","987654");

account *B = new CheckingAccount(1, "ram", "654321");

CheckingAccount c;

SavingAccount s;

//Try with all the function in both Child classes

A->deposit(1000);

B->deposit(300);

system("pause");

return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote