Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
2.1 kB
2
Indexable
Never
// Business Scenario : E-Banking portal with withdrawals,deposit,check balance function,updating pass book etc...
#include<iostream>
using namespace std;

class User
{   public:
        int ac_no;
        char name[50];
        float balance,deposit_amount,total_deposit,withdraw_amount,total_withdraw;


};

class Account:public User
{   public:
    float deposit(float deposit_amount)
    {   balance=balance+deposit_amount;
        cout<<"Updated balance after deposit : "<<balance<<endl;
    }
    float withdraw(float withdraw_amount)
    {   balance=balance-withdraw_amount;
        cout<<"Updated balance after withdrawal :"<<balance<<endl;
    }

};

class PassBook
{

};

int main()
{   User a;
    int menu;
    int c;
    c=1;
    while (c>0)
    {   cout<<"\tWelcome to the E-Banking portal"<<endl;
        cout<<"  [1] Enter user details"<<endl;
        cout<<"  [2] Display all user details"<<endl;
        cout<<"  [3] Deposits/Withdrawals"<<endl;
        cout<<"  [4] Exit Menu"<<endl;

        cin>>menu;
        if (menu==1)
        {

        }
        else if (menu==2)
        {

        }
        else if (menu==3)
        {   system("cls");
            char menu2;
            float deposits,withdrawals;
            int d;
            while (d>0)
        {
            cout<<" [A] Deposit"<<endl;
            cout<<" [B] Withdraw"<<endl;
            cin>>menu2;

            if (menu2=='A')
            {
                cout<<"Enter Deposit amount : ";
                cin>>deposits;
                a.deposit(deposits);
            }
            else if (menu2=='B')
            {
                cout<<"Enter Withdraw amount : ";
                cin>>withdrawals;
                a.withdraw(withdrawals);
            }
            else
            {
                cout<<"Wrong input Try Again";
                continue;
            }
            d++;
        }
        }
        else if (menu==4)
        {
            exit(0);
        }
        c++;


    }

    return 0;
}