Answer to Question #186174 in C++ for Ajith

Question #186174

Develop a C++ programs on BANKING SYSTEM have Customer class with name, address and phoneno. Create derived class account class with data members like account number, name, deposit, withdraw amount and type of account. A customer can deposit and withdraw amount in his account. Develop a C++ program to display the details of a customer and the remaining balance amount. [Note: Use virtual function]


1
Expert's answer
2021-04-30T02:43:52-0400
#include <iostream>
using namespace std;


//define class Customer
class Customer{
    public:
        string name;
        string address;
        string phoneNo;
        
        virtual void displayInfo(){
            cout<<"Display customers information"<<endl;
        }
        virtual void mybalance(){
            cout<<"Display customers balance"<<endl;
        }
        
    
};


//define class Account
class Account: public Customer{
    private:
        string account_no;
        string accout_name;
        double deposit_amount;
        double withdraw_amount;
        double balance;
        
    public:
    
        void displayInfo(){
           cout<<"Name"<<name<<endl;
           cout<<"Address"<<address<<endl;
           cout<<"Phone number"<<phoneNo<<endl;
        }
        void myBalance(){
            cout<<"Balance:"<<balance<<endl;
        }
    
};


int main(){
    Account a;
    a.displayInfo();
    a.myBalance();
    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