c++ program 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. Note: Create few classes namely Customer, Account, RBI (Base Class) and few derived classes (SBI, ICICI, PNB etc). Assume and implement required member variables and functions in each class.
Answers
Answer:
Class Customer
{
//Personal Details ...
// Few functions ...
}
Class Account
{
// Account Detail ...
// Few functions ...
}
Class RBI
{
Customer c; //hasA relationship
Account a; //hasA relationship
..
Public double GetInterestRate() { }
Public double GetWithdrawalLimit() { }
}
Class SBI: public RBI
{
//Use RBI functionality or define own functionality.
}
Class ICICI: public RBI
{
//Use RBI functionality or define own functionality.
}
Explanation:
Answer:
// C++ code for this answer
#include <iostream>
#include <string>
using namespace std;
class Customer{
protected:
string Name;
int age;
int minimumage;
public:
void setCustomer(string str, int x){
Name = str;
age = x;
}
};
class Account{
protected:
long long Accountnumber;
long long CIFnumber;
long long pincode;
long long minimumbalance;
long long balance;
public:
void setAccount(long long x, long long y, long long z, long long u){
Accountnumber=x;
CIFnumber=y;
pincode=z;
balance=u;
}
};
class RBI{
Customer c;
Account a;
public:
double minimumInterestrate(){
return 6.869;
}
int Widrawllimit(){
return 40000;
}
};
class SBI: public RBI,public Customer,public Account{
protected:
string Bankname = "SBI";
public:
void getinfo(){
cout<<"Name = "<<Name<<endl;
cout<<"Bank Name = "<<Bankname<<endl;
if(age>=18){
cout<<"Your age is "<<age<<endl;
}
else{
cout<<"You are a minor your age is age "<<age<<endl;
}
cout<<"Your account number is "<<Accountnumber<<endl;
cout<<"Your CIF number is "<<CIFnumber<<endl;
cout<<"Your Pincode number is "<<pincode<<endl;
cout<<"Your balance is "<<balance<<endl;
cout<<"Minimum Interestrate of the bank is "<<minimumInterestrate()<<endl;
cout<<"widrawl limit of the bank is "<<Widrawllimit()<<endl;
}
};
int main(){
SBI s;
s.setCustomer("Aditya",17);
s.setAccount(122345456, 356548593, 208024, 40999);
s.getinfo();
return 0;
}
Explanation: