All the banks operating in India are controlled by RBI. RBI has set a welldefined guideline (e.g. minimum interest rate, minimum balance allowed,
maximum withdrawal limit etc) which all banks must follow.
For example, suppose RBI has set minimum interest rate applicable to a
saving bank account to be 4% annually; however, banks are free to use 4%
interest rate or to set any rates above it.
Write a program to implement bank functionality in the above scenario.
Create few classes namely Customer, Account, RBI (Base Class) and two
derived classes (SBI, ICICI). Assume and implement required member
variables and functions in each class.
Create a menu-driven program. Use pure virtual function.
#include<iostream>
using namespace std;
class Customer{
public:
string name,address;
int age;
};
class Account{
public:
string accType;
string branchType;
};
class RBI{
public:
int withLimit,n;
double A,P,r;
float t;
long avg,tot,mb;
int setWithdrawalLimit() {
cout<<"Enter account type:\n";
string account_type;
getline(cin, account_type);
string branch_type;
cout<<"Enter branch type:\n";
getline(cin, branch_type);
if(account_type=="SAVINGS" && branch_type=="METRO") {
withLimit = 5000;
}else {
withLimit = 4000;
}
return withLimit;
}
double setInterestRate() {
A=(P+r)/n*t;
return A;
}
long setMAB() {
mb=(avg*tot)/31;
return mb;
}
};
class SBI : public RBI{
public:
double setInterestRate() {
A=P*(1+r/n)+n*t;
return A;
}
long setMAB() {
mb=(avg+tot)/30;
return mb;
}
};
class ICICI : public RBI{
public:
double setInterestRate() {
A=(P*r)/n+t;
return A;
}
int setWithdrawalLimit() {
withLimit=7000;
return withLimit;
}
};
int main(){
SBI sbi;
ICICI icici;
sbi.P=10.433;
sbi.r=7.42;
sbi.n=5;
sbi.t=7;
double st=sbi.setInterestRate();
cout<<"SBI interest rate is: "<<st<<endl;;
int iciciWL= icici.setWithdrawalLimit();
cout<<"ICICI withdraw limit is: "<<iciciWL<<endl;
}
Comments
Leave a comment