I need complete explanation of c++ code line by line. Need Explanation of all lines of code what is happening in this code where the data is stored.? Code #include #include #include #include #include #include #include using namespace std; class Bank { public: }; class ATMAccountHolders:public 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)//Limit set at Rs.20000 maximum { system("cls"); cout<<"\n\tInsufficient Available Balance in your account.\n\n"<>access; switch(access) { 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"); if(pin==12345) { system("cls"); do { system("cls"); 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) { case 1: p.deposit(); break; case 2: p.withdraw(); break; case 0: p.accountExit(); break; default:cout<<"Please Enter the Correct Number Choice"<
I need complete explanation of c++ code line by line. Need Explanation of all lines of code what is happening in this code where the data is stored.?
Code
#include <iostream>
#include <iomanip>
#include <time.h>
#include <fstream>
#include <conio.h>
#include <string.h>
#include <stdlib.h>
using namespace std;
class Bank
{
public:
};
class ATMAccountHolders:public 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()//Withdrawal Transactions
{
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)//Limit set at Rs.20000 maximum
{
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;
ATMAccountHolders p;
system("cls");
system ("Color 1f");
cout << "\t\tCurrent date : ";
time_t now;
time(&now);
printf("%s\n", ctime(&now));;
//Give space for the function of date and time
cout<<"\t\t\t--------------------\n"<<endl;
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)
{
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");
if(pin==12345)
{
system("cls");
do
{
system("cls");
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)
{
case 1:
p.deposit();
break;
case 2:
p.withdraw();
break;
case 0:
p.accountExit();
break;
default:cout<<"Please Enter the Correct Number Choice"<<endl;
}
}while(e!=0);
break;
}
else
{
system("cls");
cout<<"\nYou had made your attempt which failed!!! No More attempts allowed!! Sorry!!\n\n";
system("PAUSE");
exit (1);
}
case 0://pin to access account
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;
}
Step by step
Solved in 3 steps with 2 images