AIM:-Generally a bank account contains data member as account number, name of customer,               type of account and amount. Design a class to model the bank account. Write a menu                driven program to perform basic operations on bank account like deposit, withdraw,                      display balance, display with full details

 

 

Input:-

 

#include<iostream>

using namespace std;

class bank

{

    

    int ac_no;

    float amount,w,d;

    char name[50],type_of_account[10],ch;

    

public:

    

    void accept()

    {

        cout<<“enter acount number:”;

        cin>>ac_no;

        cout<<“enter name:”;

        cin>>name;

        cout<<“enter type of account:”;

        cin>>type_of_account;

        cout<<“enter amount:”;

        cin>>amount;

        cout<<“enter any in withdraw,deposit:”;

        cin>>ch;

    }

    

    void calculat()

    {

        if(ch==‘w’)

        {

            cout<<“enter Rs:”;

            cin>>w;

            

            amount-=w;

            

        }

        else if(ch == ‘d’)

        {

            cout<<“enter deposit Rs:”;

            cin>>d;

            

            amount+=d;

            

        }

        

    }

    

   

void display()

    {

        cout<<“\n|————————————|”;;

        cout<<“\n|         <<name<<” details             |”;

        cout<<“\n|————————————|”;

        

        cout<<“\n|name:”<<name<<                        |”;

        cout<<“\n|account number:”<<ac_no<<                  |”;

        cout<<“\n|type of account:”<<type_of_account<<              |”;

        cout<<“\n|amoutn:”<<amount<<                        |”;

        cout<<“\n|————————————|\n”;

    }

    

};

int main()

{

    bank b;

    b.accept();

    b.calculat();

    b.display();

    

    return 0;

}

output:-

enter acount number:111

enter name:dhaval

enter type of account:saving

enter amount:50000

enter any in withdraw,deposit:d

enter deposit Rs:10000

|————————————|

|         dhaval details                      |

|————————————|

|name:dhaval                                 

|account number:111                   |

|type of account:saving                |

|amoutn:60000                              |

|————————————|

 

Advertisements