/*******************       EDITOR VISUAL STUDIO CODE       **********************/
   J_3_P_11
/*******************************************************************************************
Define the following classes.
Class Data members Derived from
Account name, no, actype (C for current & none
S for saving
Current Chequeno, balance Account
Saving Balance Account
Also include appropriate constructors and other member functions for performing various
activities like to accept deposits of ten customers. To update balance of any customers and
to display the information of all the customers,
Write a C++ program, which implements these classes
*********************************************************************************************/
#include <iostream>
#include <conio.h>
using namespace std;

class account
{
public:
    int accno;
    char accname[20], actype[3];

public:
    int getd()
    {
        cout << "\tEnter Account Name : ";
        cin >> accname;

        cout << "\tEnter Account Number :";
        cin >> accno;

        cout << "\tEnter Account Type (S or C) : ";
        cin >> actype;
        return 0;
    }
    int display()
    {
        cout << endl
             << "\tAccount name : " << accname;
        cout << endl
             << "\tAccount Number : " << accno;
        cout << endl
             << "\tAccount Type : " << actype << endl;
        return 0;
    }
};
class saving : public account
{
public:
    long int balance;

public:
    saving()
    {
        balance = 0;
    }
    int deposite()
    {

        cout << "\n\n----------------------------------------------------------------\n";
        cout << "\t\tThis is Saving Account  \n";
        cout << "----------------------------------------------------------------\n\n";

        getd();
        display();
        long int acno, amt;

        cout << "\n\n----------------------------------------------------------------\n";
        cout << "\t\t Deposite Amount in Saving Account  \n";
        cout << "----------------------------------------------------------------\n\n";

        cout << "\tEnter Account Number :";
        cin >> acno;

        cout << "\tEnter Amount to Deposite s: ";
        cin >> amt;

        balance += amt;

        return 0;
    }
    int withdraw()
    {
        int acno, amt;
        cout << "\n\n----------------------------------------------------------------\n";
        cout << "\t\t Withdraw Amount  \n";
        cout << "----------------------------------------------------------------\n\n";

        cout << "\tEnter Account Number :";
        cin >> acno;

        cout << "\tEnter Amount to Withdraw : ";
        cin >> amt;

        balance -= amt;
        return 0;
    }
    int displays()
    {

        cout << "\nBalance : " << balance << endl;
        return 0;
    }
};
class current : virtual public account
{
public:
    long int balance;

public:
    current()
    {
        balance = 0;
    }
    int deposite()
    {
        cout << "\n\n----------------------------------------------------------------\n";
        cout << "\t\tThis is Current Account  \n";
        cout << "----------------------------------------------------------------\n\n";

        getd();
        display();
        long int acno, amt;

        cout << "\n\n----------------------------------------------------------------\n";
        cout << "\t\t Deposite Amount in current Account   \n";
        cout << "----------------------------------------------------------------\n\n";

        cout << "\tEnter Account Number :";
        cin >> acno;

        cout << "\tEnter Amount to Deposite : ";
        cin >> amt;

        balance += amt;

        cout << "\n Balance : " << balance << endl;
        return 0;
    }
    int getchk()
    {
        long int checkno, chamt;
        cout << "\n\tEnter check Number : ";
        cin >> checkno;

        cout << "\tEnter Amount in check  : ";
        cin >> chamt;

        balance -= chamt;

        cout << "\n Balance : " << balance;
        return 0;
    }
};
int main()
{
    system("cls");
    int i;
    current obj;
    saving obj1;

    obj1.deposite();
    obj1.displays();
    obj1.withdraw();
    obj1.displays();

    obj.deposite();
    obj.getchk();

    getch();
    return 0;
}

Comments

Popular posts from this blog

7.Write a program to read a list containing item name, item code and cost interactively and produce a three-column output as shown below. NAME CODE COST Turbo C++ 1001 250.95 C Primer 905 95.70 ------------- ------- ---------- ------------- ------- ---------- Note that the name and code are left-justified and the cost is right-justified with a precision of two digits. Trailing zeros are shown.

Quetion 6 : Consider the "in-order-issue/in-order-completion" execution sequence shown in f In Figure Decode OWE Execute 12 12 12 14 16 13 16 13 15 15 16 Write 024/06/02 11 3 4 11 12 13 13 N 15 16 a. Identify the most likely reason why I could not enter the execute fourth cycle. stage until the [2] b. Will "in-order issue/out-of-order completion" or "out-of-order issue/out-of-order completion" fix this? If so, which? Explain

8.odd and even number using if else.