I want the below code modified that works for multi user in below code there are only one user but i need multi user up to 10? Code #include #include #include Using namespace std; class Bank {public:}; class ATMAccountHolders:Bank {string accountHolders;  string accountHoldersAddress, branch;  int accountNumber;  double startBalance;  double accountBalance;  double amount;  int count; Public:   void deposit();   void withdraw();   void accountExit();  ATMAccountHolders()  {accountNumber = 7787;   accountHolders = " Ammad Naseer";   accountHoldersAddress = " House no.112";   startBalance = 6000.00;   accountBalance = 6000.00;   branch = " Islamabad";   amount = 20000;  } }; void ATMAccountHolders::deposit() { system("cls");  cout<<" ATM ACCOUNT DEPOSIT SYSTEM ";  cout<<"\n\nThe Names of the Account Holders are :"<>amount;  accountBalance=startBalance+amount ;  cout<<"\n\tYour new available Balanced Amount is Rs."<>amount;  if(amount>accountBalance||amount>20000)  { system("cls");   cout<<"\n\tInsufficient Available Balance in your account.\n\n"<>access;  switch(access)  {   //press 1 to access the account   case 1://pin to access account    system("cls");    int i, pin;    cout<<"\n\nEnter Your Acc Pin Access Number! [Only one attempt is allowed]\n\n"<>pin;    system("cls");    //checking the entered pin and it should be only 12345    if(pin==12345)      {       system("cls");              do       {        //clearing the system screen        system("cls");        //displaying the menu        cout << "\t\tEnter [1] To Deposit Cash" << endl;        cout << "\t\tEnter [2] To Withdraw Cash" << endl;        cout << "\t\tEnter [0] to Exit ATM" << endl << endl;        cout << "\tPLEASE ENTER A SELECTION AND PRESS RETURN KEY: \n\n";        cin>>e;        switch(e)        {         //option 1 for deposit operation and          //it will call the deposit function         case 1:          p.deposit();          break;         //option 2 for withdraw operation and         //it will call the withdraw function         case 2:          p.withdraw();          break;         //option 0 to exit         case 0:          p.accountExit();          break;         default:cout<<"Please Enter the Correct Number Choice"<

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter12: Adding Functionality To Your Classes
Section12.2: Providing Class Conversion Capabilities
Problem 6E
icon
Related questions
Question

I want the below code modified that works for multi user in below code there are only one user but i need multi user up to 10?

Code

#include <iostream>

#include <time.h>

#include <conio.h>

Using namespace std;

class Bank

{public:};

class ATMAccountHolders:Bank

{string accountHolders;

 string accountHoldersAddress, branch;

 int accountNumber;

 double startBalance;

 double accountBalance;

 double amount;

 int count;

Public:

  void deposit();

  void withdraw();

  void accountExit();

 ATMAccountHolders()

 {accountNumber = 7787;

  accountHolders = " Ammad Naseer";

  accountHoldersAddress = " House no.112";

  startBalance = 6000.00;

  accountBalance = 6000.00;

  branch = " Islamabad";

  amount = 20000;

 }

};

void ATMAccountHolders::deposit()

{ system("cls");

 cout<<" ATM ACCOUNT DEPOSIT SYSTEM ";

 cout<<"\n\nThe Names of the Account Holders are :"<<accountHolders<<"\n\n";

 cout<<"\tThe Account Holders' address is :"<<accountHoldersAddress<<"\n\n";

 cout<<"\tThe Branch location is :"<<branch<<"\n\n";

 cout<<"\tAccount number :"<<accountNumber<<"\n\n";

 cout<<"\tStarting account balance :Rs. "<<startBalance<<"\n\n";

 cout<<"\tPresent available balance :Rs. "<<accountBalance<<"\n\n";

 cout<<"\tEnter the Amount to be Deposited:Rs.";

 double amount;

 cin>>amount;

 accountBalance=startBalance+amount ;

 cout<<"\n\tYour new available Balanced Amount is Rs."<<accountBalance<<endl ;

 cout<<"\n\t\t\tThank You!\n\n"<<endl;

 cout<<"Press any key to Return to the Main Menu\n\n";

 system("PAUSE"); } 

void ATMAccountHolders::withdraw()

{system("cls"); 

 cout<<"\n\nThe Names of the Account Holders are :"<<accountHolders<<"\n\n";

 cout<<"\tThe Account Holders' address is :"<<accountHoldersAddress<<"\n\n";

 cout<<"\tThe Branch location is :"<<branch<<"\n\n";

 cout<<"\tAccount number :"<<accountNumber<<"\n\n";

 cout<<"\tPresent available balance :Rs."<<accountBalance<<"\n\n";

 cout<<"\tEnter the Amount to be Withdrawn Rs.";

 double amount;

 cin>>amount;

 if(amount>accountBalance||amount>20000)

 { system("cls");

  cout<<"\n\tInsufficient Available Balance in your account.\n\n"<<endl;

  cout<<"\t\t\tSorry !!\n"<<endl;

  system("PAUSE");

 }

 else

 double b;

 accountBalance=accountBalance-amount ;

 cout<<"\n\nThe Names of the Account Holders are :"<<accountHolders<<"\n\n";

 cout<<"\tThe Account Holders' address is :"<<accountHoldersAddress<<"\n\n";

 cout<<"\tThe Branch location is :"<<branch<<"\n\n";

 cout<<"\tAccount number :"<<accountNumber<<"\n\n";

 cout<<"Your new available Balanced Amount is Rs."<<accountBalance<<endl ;

 cout<<"Press any key to Return to the Main Menu\n\n";

 system("PAUSE");}

void ATMAccountHolders::accountExit(){

 system("cls");

 cout<<"\n\n\t\t BROUGHT TO YOU BY AMMAD NASEER (SP20-BCS-156) \n\n";

 system("PAUSE");

 exit(1);

}

int main()

{

 int e;

 //creating object of the class 

 ATMAccountHolders p;

 //clearing the system screen

 system("cls");

 //setting the colour of the screen

 system ("Color 1f");

 //displaying the current date

 cout << "\t\tCurrent date : ";

 time_t now;

 time(&now);

 //displaying the time

 printf("%s\n", ctime(&now));;

 //Give space for the function of date and time

 cout<<"\t\t\t--------------------\n"<<endl;

 //displaying the menu

 cout<<"\tPress 1 and Then Press Enter to Access Your Account Via Pin Number\n\n";

 cout<<"\t\t\t\t\t OR \n\n";

 cout<<"\tPress 0 and press Enter to get Help.\n\n";

 int access;

 cin>>access;

 switch(access)

 {

  //press 1 to access the account

  case 1://pin to access account

   system("cls");

   int i, pin;

   cout<<"\n\nEnter Your Acc Pin Access Number! [Only one attempt is allowed]\n\n"<<endl;

   cin>>pin;

   system("cls");

   //checking the entered pin and it should be only 12345

   if(pin==12345)

 

   {

 

    system("cls");

 

    

 

    do

 

    {

 

     //clearing the system screen

 

     system("cls");

 

     //displaying the menu

 

     cout << "\t\tEnter [1] To Deposit Cash" << endl;

 

     cout << "\t\tEnter [2] To Withdraw Cash" << endl;

 

     cout << "\t\tEnter [0] to Exit ATM" << endl << endl;

 

     cout << "\tPLEASE ENTER A SELECTION AND PRESS RETURN KEY: \n\n";

 

     cin>>e;

 

     switch(e)

 

     {

 

      //option 1 for deposit operation and 

 

      //it will call the deposit function

 

      case 1:

 

       p.deposit();

 

       break;

 

      //option 2 for withdraw operation and

 

      //it will call the withdraw function

 

      case 2:

 

       p.withdraw();

 

       break;

 

      //option 0 to exit

 

      case 0:

 

       p.accountExit();

 

       break;

 

      default:cout<<"Please Enter the Correct Number Choice"<<endl;

 

     }

 

    }while(e!=0);

 

    break;

 

   }

 

   //if the entered pin is wrong

 

   else

 

   {

 

    //clearing the screen

 

    system("cls");

 

    //

 

    cout<<"\nYou had made your attempt which failed!!! No More attempts allowed!! Sorry!!\n\n";

 

    system("PAUSE");

 

    exit (1);

 

   }

 

  //if the user wants help

 

  case 0:

 

   system("cls");

 

   

 

   cout<<"\n\n\t\tBank representative for assistance during bank opening hours\n\n";

 

   cout<<"\t\tThanks for, your choice today!!\n\n";

 

   

 

   system ("PAUSE");

 

   exit(1);

 

   break;

 

 } 

 

 system("PAUSE");

 

 return 0;

 

}

Expert Solution
steps

Step by step

Solved in 2 steps with 4 images

Blurred answer
Knowledge Booster
Concept of pointer parameter
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning