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 using inheritance concept by c++
Question
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 using inheritance concept by c++
Solution
Sure, here is a simple implementation of the scenario in C++:
#include<iostream>
using namespace std;
// Base class
class RBI{
public:
virtual float getInterestRate() = 0;
virtual float getMinimumBalance() = 0;
};
// Derived classes
class SBI : public RBI{
public:
float getInterestRate() { return 4.5; }
float getMinimumBalance() { return 2000; }
};
class ICICI : public RBI{
public:
float getInterestRate() { return 5; }
float getMinimumBalance() { return 3000; }
};
class PNB : public RBI{
public:
float getInterestRate() { return 4.8; }
float getMinimumBalance() { return 2500; }
};
// Customer class
class Customer{
public:
string name;
RBI *bank;
Customer(string name, RBI *bank) : name(name), bank(bank) {}
void getDetails() {
cout << "Name: " << name << "\nBank Interest Rate: " << bank->getInterestRate() << "\nMinimum Balance: " << bank->getMinimumBalance() << endl;
}
};
// Account class
class Account{
public:
Customer *customer;
float balance;
Account(Customer *customer, float balance) : customer(customer), balance(balance) {}
void getAccountDetails() {
customer->getDetails();
cout << "Account Balance: " << balance << endl;
}
};
int main() {
// Create customers with their respective banks
SBI sbi;
Customer cust1("John", &sbi);
Account acc1(&cust1, 5000);
acc1.getAccountDetails();
ICICI icici;
Customer cust2("Jane", &icici);
Account acc2(&cust2, 6000);
acc2.getAccountDetails();
PNB pnb;
Customer cust3("Doe", &pnb);
Account acc3(&cust3, 7000);
acc3.getAccountDetails();
return 0;
}
This program creates a base class RBI with two pure virtual functions getInterestRate() and getMinimumBalance(). Three derived classes SBI, ICICI, and PNB inherit from RBI and implement these functions. The Customer class has a RBI pointer which is used to point to the bank of the customer. The Account class has a Customer pointer and a balance. The getAccountDetails() function in Account class prints the details of the customer and the account balance.
Similar Questions
What is the term used for the interest rate at which the Reserve Bank of India (RBI) lends money to commercial banks?
The Reserve Bank of India (RBI) acts as the central bank of India and is responsible for: A. Fiscal policy formulation B. Monetary policy formulation C. Industrial regulation D. Foreign policy
The structure of the Indian financial system includes:Question 17AnswerA.Central Bank, Commercial Banks, and Development BanksB.All of the aboveC.State Banks, Private Banks, and Cooperative BanksD.Agricultural Banks, Industrial Banks, and Export Banks
Create an abstract class Bank with an abstract method getRateOfInterest(); In class SBI calculate the interest amount as 5% of the principal by overriding the method getRateOfInterest(); and display. In the class PNB calculate the interest amount as 6% of the principal by overriding the method getRateOfInterest(); and display
Which part of the financial market is not regulated by the Reserve Bank of India?Interest rate marketsGovernment Securities marketForeign exchange marketsInterest rate derivativesNone of the above
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.