Answer to Question #329712 in C++ for Ashwathi

Question #329712

Implement a program of maintaining banking account information system using multiple inheritance in C++ Programming. Here class savings derived from class account and class user. Use appropriate functions and variables

1
Expert's answer
2022-04-20T12:41:05-0400
#include<iostream>
#include<stdio.h>
using namespace std;

class customer
{
        char nm[20];
        long phno;
    public:
        void acceptc()
        {
                cout<<"\n Enter Customer Name      :  ";
                cin>>nm;
                cout<<"\n Enter Customer Phone No. :  ";
                cin>>phno;
        }
        void dispc()
        {
                cout<<"\n Details of Customer \n";
                cout<<"\n ----------------------------------------\n";
                cout<<"\n Customer Name            :  "<<nm;
                cout<<"\n Customer Phone No.       :  "<<phno;      
        }
};
class deposit:public customer
{
        int accno, balance;
    public:
        void acceptd()
        {
                cout<<"\n Enter Customer A/c No    :  ";
                cin>>accno;
                cout<<"\n Enter Balance            :  ";
                cin>>balance;
        }
        void dispd()
        {
                cout<<"\n Customer A/c No          :  "<<accno;
                cout<<"\n Balance                  :  "<<balance;
                cout<<"\n ----------------------------------------\n";
        }
};
class borrow:public deposit
{
        int loan_no,loan_amt;
    public:
        void acceptb()
        {
                cout<<"\n Enter Loan No            :  ";
                cin>>loan_no;
                cout<<"\n Enter Loan Amount        :  ";
                cin>>loan_amt;
                cout<<"\n ----------------------------------------\n";
        }
        void dispb()
        {
                cout<<"\n Loan No                  :  "<<loan_no;
                cout<<"\n Loan Amount              :  "<<loan_amt;
                cout<<"\n ----------------------------------------\n";
        }
};
int main()
{
        borrow *b1;
        int n,i;
        cout<<"\n Enter No. of Customer Details You Want  :  ";
        cin>>n;
        b1=new borrow[n];
        for(i=0; i<n; i++)
        {
                1[i].acceptc();
                b1[i].acceptd();
                b1[i].acceptb();
        }
        for(i=0; i<n; i++)
        {
                b1[i].dispc();
                b1[i].dispd();
                b1[i].dispb();
        }
        return 0;
}

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