Answer to Question #256900 in C++ for soham

Question #256900

All the banks operating in India are controlled by RBI. RBI has set a well￾defined 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.



1
Expert's answer
2021-10-27T16:23:43-0400
#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;	
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS