Write a c++ program to declare classes namely Customer, Account, RBI (Base Class) and derived classes (SBI and ICICI) and do the following: 1. Take the value of bank name and interest rate from user. 2. Make function to calculate the homeloan rate HomeloanRate(SBI)= RBIRate+0.5 HomeloanRate(ICICI)= RBIRate+1.5 3. Display the rate based on bank name entered by user. (note:Make use of virtual function here)
using namespace std;
/*
Write a c++ program to declare classes namely Customer, Account, RBI (Base Class) and derived classes (SBI and ICICI) and do the following:
1. Take the value of bank name and interest rate from user.
2. Make function to calculate the homeloan rate HomeloanRate(SBI)= RBIRate+0.5 HomeloanRate(ICICI)= RBIRate+1.5
3. Display the rate based on bank name entered by user. (note:Make use of virtual function here)
*/
class RBI
{
public:
float RBIRate;
void Display(string u, string b, float r)
{
cout<<"\n\n\tUser Nbame: "<<u;
cout<<"\n\tBank: "<<b;
cout<<"\n\tRate of Interest: "<<r;
}
};
class Customer:RBI
{
public:
float RoI;
string Bank;
string User;
void GetUser(void)
{
cout<<"\n\tEnter User Name: "; cin>>User;
}
void getBank(void)
{
cout<<"\n\tEnter Bank Name: "; cin>>Bank;
}
void getRoI(void)
{
cout<<"\n\tEnter Rate ofInterest: "; cin>>RoI;
}
};
class SBI:RBI
{
public:
float HomeLoan;
void CalculateHomeLoanRate(string b, float RBIRate)
{
HomeLR = RBIRate+0.5;
cout<<"\n\tHome Loan Rate at SBI = "<<HomeLR;
}
};
class ICICI:RBI
{
public:
float HomeLoan;
void CalculateHomeLoanRate(string b, float RBIRate)
{
HomeLR = RBIRate+1.5;
cout<<"\n\tHome Loan Rate at ICICI = "<<HomeLR;
}
}
int main()
{
class RBI B1,B2;
class SBI S1, S2;
class ICICI I1,I2;
class Customer C1,C2;
}
Comments
Leave a comment