Banking Project Must be in C++ Design and implement a hierarchy inheritance syst
ID: 3919698 • Letter: B
Question
Banking Project Must be in C++
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 a user input an ID number and customer’s full name and then require 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 :
int numberOfTrans = 0;
string accountType;
int id;
string name;
int security_number;
double balance;
public:
Account( int localId,string person_name, int ss_number , double openingAmount,string accountTypeL) {
id = localId;
name = person_name;
security_number = ss_number ;
balance = openingAmount;
accountType = accountTypeL;
}
friend void printBalance(Account accountLocal);
void setBalance( double wid );
void withdraw(double bal);
void deposit(double bal);
void calculateIntrest();
void transferFund(Account acc, double bal);
};
void Account::setBalance( double openingAmt ) {
balance = openingAmt;
}
class SavingAccount : public Account {
public:
bool isActive = true;
double minBalance = 25;
void withdraw(double bal);
void deposit(double bal);
void calculateIntrest();
void transferFund(Account acc, double bal);
SavingAccount( int localId1,string person_name1, int ss_number1 , double openingAmount1,string accountTypeLL) :Account(localId1,person_name1,ss_number1,openingAmount1,accountTypeLL){
}
};
class CheckingAccount : public Account {
public:
bool isActive = true;
double minBalance = 300;
int numberOfTrans = 0;
void withdraw(double bal);
void deposit(double bal);
void calculateIntrest();
//void transferFund(Account acc, double bal);
CheckingAccount( int localId1,string person_name1, int ss_number1 , double openingAmount1,string accountTypeI) :Account(localId1,person_name1,ss_number1,openingAmount1,accountTypeI){
}
};
void printBalance(Account accountArg) {
cout << " Account Balance : " << accountArg.balance <<endl;
}
void SavingAccount::withdraw(double balanceTran){
cout << "calling" << endl;
balance = balance - balanceTran;
}
void SavingAccount::transferFund(Account acc,double balanceTran){
if(balance < 25 || isActive == false){
cout << " no more withdrawals will be allowed, as minimum balance left in account";
}else if(balance < balanceTran ){
cout << " insufficient balance found in account as insufficient fund found in account";
}else{
withdraw(balanceTran);
numberOfTrans = numberOfTrans + 1;
if(acc.accountType == "CHECKING"){
CheckingAccount *checkAcc = (CheckingAccount *) &acc;
checkAcc->deposit(balanceTran);
cout << " Balance transfered succeessfully wiht the account holder name : " << checkAcc->name << " , New Balance : " << checkAcc->balance;
}
}
}
void CheckingAccount::withdraw(double balanceTran){
if(balance < 25 || isActive == false){
cout << " no more withdrawals will be allowed, as insufficient balance found in account";
}else{
balance = balance - balanceTran;
}
}
void CheckingAccount::deposit(double balanceTran){
balance = balance + balanceTran;
}
// Main function for the program
int main( ) {
SavingAccount account1(1,"Deepak",101,2000.00,"SAVING");
printBalance(account1);
CheckingAccount account2(1,"rajdev",102,200.00 ,"CHECKING");
printBalance(account2);
account1.transferFund(account2,200);
//printBalance(account1);
//printBalance(account2);
return 0;
}
Output :
Created two account :
SavingAccount account1(1,"Deepak",101,2000.00,"SAVING");
CheckingAccount account2(1,"rajdev",102,200.00 ,"CHECKING");
where accoutType is maintained.
account 1 is transfering amount 200$ to account2.
so finally running main method following result will be recieved.
---------------------
Account Balance : 2000
Account Balance : 200
Balance transfered succeessfully wiht the account holder name : rajdev , New Balance : 400
I covered the following in this program and for rest of the question , need to post this question again wiht updated code. Let mw know if you need any further assitance on above given code.
-----------------------------------------------------
1. The account must have a user input an ID number and customer’s full name and then require his/her social security number.
2. General types of banking transactions for both accounts, Checking and Savings: withdraw, deposit, figure out the balance, and transfer funds (between the two accounts, from Checking to Savings and vice versa)
3. 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.
4. Savings restrictions: Become inactive if the balance falls less than $25, and under such situation, no more withdrawals may be allowed.
I could have been covered few more things but i tried to include each aspect ( except calculating intrest ) like withdrawl, deposit, balace check, friend funciton uses etc. so that on similar line we can make rest of the changes. Thanks
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.