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="">"\n\nthe><><>
cout<"\tthe account="" holders'="" address="" is="">"\tthe><><>
cout<"\tthe branch="" location="" is="">"\tthe><><>
cout<"\taccount number="">"\taccount><><>
cout<"\tstarting account="" balance="" :rs.="">"\tstarting><><>
cout<"\tpresent available="" balance="" :rs.="">"\tpresent><><>
cout<"\tenter the="" amount="" to="" be="">"\tenter>
double amount;
cin>>amount;
accountBalance=startBalance+amount ;
cout<"\n\tyour new="" available="" balanced="" amount="" is="">"\n\tyour><>
cout<"\n\t\t\tthank>"\n\t\t\tthank><>
cout<"press any="" key="" to="" return="" to="" the="" main="">"press>
system("PAUSE"); }
void ATMAccountHolders::withdraw()
{system("cls");
cout<"\n\nthe names="" of="" the="" account="" holders="" are="">"\n\nthe><><>
cout<"\tthe account="" holders'="" address="" is="">"\tthe><><>
cout<"\tthe branch="" location="" is="">"\tthe><><>
cout<"\taccount number="">"\taccount><><>
cout<"\tpresent available="" balance="">"\tpresent><><>
cout<"\tenter the="" amount="" to="" be="" withdrawn="">"\tenter>
double amount;
cin>>amount;
if(amount>accountBalance||amount>20000)
{ system("cls");
cout<"\n\tinsufficient available="" balance="" in="" your="">"\n\tinsufficient><>
cout<"\t\t\tsorry>"\t\t\tsorry><>
system("PAUSE");
}
else
double b;
accountBalance=accountBalance-amount ;
cout<"\n\nthe names="" of="" the="" account="" holders="" are="">"\n\nthe><><>
cout<"\tthe account="" holders'="" address="" is="">"\tthe><><>
cout<"\tthe branch="" location="" is="">"\tthe><><>
cout<"\taccount number="">"\taccount><><>
cout<"your new="" available="" balanced="" amount="" is="">"your><>
cout<"press any="" key="" to="" return="" to="" the="" main="">"press>
system("PAUSE");}
void ATMAccountHolders::accountExit(){
system("cls");
cout<"\n\n\t\t brought="" to="" you="" by="" ammad="" naseer="" (sp20-bcs-156)="">"\n\n\t\t>
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<><>
//displaying the menu
cout<"\tpress 1="" and="" then="" press="" enter="" to="" access="" your="" account="" via="" pin="">"\tpress>
cout<"\t\t\t\t\t or="">"\t\t\t\t\t>
cout<"\tpress 0="" and="" press="" enter="" to="" get="">"\tpress>
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="">"\n\nenter><>
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"=""><>
cout < "\t\tenter="" [2]="" to="" withdraw="" cash"=""><>
cout < "\t\tenter="" [0]="" to="" exit="" atm"="">< endl=""><>
cout < "\tplease="" enter="" a="" selection="" and="" press="" return="" key:="">
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="">"please><>
}
}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!!="">"\nyou>
system("PAUSE");
exit (1);
}
//if the user wants help
case 0:
system("cls");
cout<"\n\n\t\tbank representative="" for="" assistance="" during="" bank="" opening="">"\n\n\t\tbank>
cout<"\t\tthanks for,="" your="" choice="">"\t\tthanks>
system ("PAUSE");
exit(1);
break;
}
system("PAUSE");
return 0;
}