-
Notifications
You must be signed in to change notification settings - Fork 0
/
ATM program_Neloy.cpp
334 lines (289 loc) · 13.6 KB
/
ATM program_Neloy.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
//ATM Banking program developed by Asif Ahmed Neloy
#include <iostream>
#include <iomanip>
#include <fstream>
#include <conio.h>
#include <string.h>
#include <stdlib.h>
#include<process.h>
#include<dos.h>
using namespace std;
//==================================================================================================
class Bank //abstract base class
{
public:
double startBalance;
string COKAccountHolders;
double limit;
};
//==================================================================================================
class ATMAccountHolders:public Bank
{
string accountHolders;
string accountHoldersAddress, branch;
int accountNumber;
double startBalance;
double accountBalance;
double accountInterest;
double amount;
int count;
public:
void deposit();
void withdraw();
void details();
void payBills();
void accountExit();
void interest();
ATMAccountHolders()
{
accountNumber = 5678;
accountHolders = "Asif Ahmed Neloy";
accountHoldersAddress = "house 44/D, Block-D, Road 4, Bashundhara R/A";
startBalance = 30000.00;
accountBalance = 20000.00;
branch = "Dhaka";
amount = 20000;
}
};
//==================================================================================================
void ATMAccountHolders::interest()
{
system("cls");
cout<<"\n==========================ATM ACCOUNT INTEREST PAYMENT==========================\n\n";
cout<<"\tThe Interest is calculate over the last SIX months on the average account balance\n";
cout<<"\n\t\tInterest Rate payable is 10% per annum."<<endl;
cout<<"\t\tView the accumulated interest? Press 1 for Yes OR 0 for NO.\n\n";
cout<<"==========================ATM ACCOUNT INTEREST PAYMENT==========================\n\n";
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<<"============================+++++++++++++++++++++++============================\n\n";
cout<<"\tStarting account balance :$"<<startBalance<<"\n\n";
cout<<"\tPresent available balance :$"<<accountBalance<<"\n\n";
accountInterest=accountBalance+(accountBalance*1.050);
cout<<"\tPresent available balance + interest for 6 months :$"<<accountInterest<<"\n\n";
cout<<"Press any key to Return to the Main Menu\n\n";
system("PAUSE");
}
//==================================================================================================
//==================================================================================================
void ATMAccountHolders::deposit()
{
system("cls");
cout<<"\n===========================ATM ACCOUNT DEPOSIT SYSTEM==========================\n\n";
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<<"============================+++++++++++++++++++++++============================\n\n";
cout<<"\tStarting account balance :$"<<startBalance<<"\n\n";
cout<<"\tPresent available balance :$"<<accountBalance<<"\n\n";
cout<<"\tEnter the Amount to be Deposited $";
double amount;
cin>>amount;
accountBalance=startBalance+amount ;
cout<<"\n\tYour new available Balanced Amount is $"<<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============================ATM ACCOUNT WTHDRAWAL=============================\n\n";
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<<"============================+++++++++++++++++++++++============================\n\n";
cout<<"\tStarting account balance :$"<<startBalance<<"\n\n";
cout<<"\tPresent available balance :$"<<accountBalance<<"\n\n";
cout<<"\tEnter the Amount to be Withdrawn $";
double amount;
cin>>amount;
if(amount>accountBalance||amount>9000)//Limit set at $9000 maximum after paying bills
{
system("cls");
cout<<"\n============================ATM ACCOUNT WITHDRAWAL=============================\n\n";
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<<"============================+++++++++++++++++++++++============================\n\n";
cout<<"\n\tInsufficient Available Balance in your account.\n\n"<<endl;
cout<<"\t\t\tSorry !!\n"<<endl;
system("PAUSE");
}
else
{
double b;
accountBalance=startBalance-amount ;
system("cls");
cout<<"\n============================ATM ACCOUNT WTHDRAWAL=============================\n\n";
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<<"============================+++++++++++++++++++++++============================\n\n";
cout<<"Your new available Balanced Amount is $"<<accountBalance<<endl ;
cout<<"Press any key to Return to the Main Menu\n\n";
system("PAUSE");
}
}
//==================================================================================================
void ATMAccountHolders::payBills()
{
system("cls");
cout<<"\n===========================ATM BILLS PAYMENT SYSTEM==========================\n";
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<<"====================++THANK YOU++============================\n\n";
cout<<"Pay Electric Company electricity bill of $2000.00 now?\n\n";
cout<<"\t\tPress 1 for Yes OR Press 0 for No\n\n";
int r;
cin>>r;
if(r=1)
{accountBalance=startBalance-2000;
system("cls");
cout<<"\n===========================ATM BILLS PAYMENT SYSTEM==========================\n";
cout<<"\n\tYour electricity bill of $2000.00 has been paid.\n\n";
cout<<"\tYour account new Available Balanced Amount is $"<<accountBalance<<endl ;
cout<<"\n============================+++++++++++++++++++++++===========================\n\n";
cout<<"Press any key to Return to the Main Menu\n\n";
}
if(r=0)
{
cout<<"\n===========================ATM BILLS PAYMENT SYSTEM==========================\n\n";
cout<<"\n\n\tExiting Bill Payment System. Thank you!.\n\n";
cout<<"====================++THANK YOU++============================\n\n";
}
system("PAUSE");
};
//==================================================================================================
void ATMAccountHolders::details()
{
system("cls");
cout<<"\n============================ATM ACCOUNT DETAILS=============================\n\n";
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<<"====================++THANK YOU++============================\n\n";
cout<<"============================+++++++++++++++++++++++============================\n\n";
cout<<"Press any key to Return to the Main Menu\n\n";
system("PAUSE");
}
//==================================================================================================
void ATMAccountHolders::accountExit()
{
system("cls");
cout<<"\n============================ATM ACCOUNT EXIT=============================\n\n";
cout<<"\n\n\t\tEXITING...........EXITING...............EXITING\n\n";
cout<<"====================++THANK YOU++============================\n\n";
cout<<"============================+++++++++++++++++++++++============================\n\n";
system("PAUSE");
exit(1);
}
class Limits:public Bank
{
public:
void SetLimit(double NewLimit)
{}
double Getlimit()
{}
};
int main()
{
int e;
ATMAccountHolders p;
cout<<"\n============================WELCOME TO ATM==================================\n\n";
cout<<"\t\t\t--------------------\n"<<endl;
cout<<"\t\t\t--------------------\n"<<endl;
cout<<"============================WELCOME TO ATM==================================\n\n";
//==================================================================================================
cout<<"\tPress 1 and 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============================ATM ACCOUNT ACCESS==================================\n\n";
cout<<"\n\nWhat is your account Pin access Number? Only one attempt allowed.\n\n"<<endl;
cout<<"============================ATM ACCOUNT ACCESS==================================\n\n";
cin>>pin;
system("cls");
if(pin==12345)
{
system("cls");
do
{
system("cls");
//system ("Color 1a");
cout << endl << "\n======================ATM Main Menu Screen======================\n" << endl << endl;
cout << "\t\tEnter (1) for Cash Deposit" << endl;
cout << "\t\tEnter (2) for Cash Withdrawal" << endl;
cout << "\t\tEnter (3) for Balance Inquiry" << endl;
cout << "\t\tEnter (4) for Pay Bills" << endl;
cout << "\t\tEnter (5) to Account Interest Payment" << endl;
cout << "\t\tEnter (0) to Exit ATM" << endl << endl;
cout << "\tPLEASE ENTER A SELECTION AND PRESS RETURN KEY: \n\n";
cout<<"==========================ATM MAIN MENU================================\n\n";
cin>>e;
switch(e)
{
case 1:
p.deposit();
break;
case 2:
p.withdraw();
break;
case 3:
p.details();
break;
case 4:
p.payBills();
break;
case 5:
p.interest();
break;
case 0:
p.accountExit();
break;
default:cout<<"Please Enter the Correct Number Choice"<<endl;
}
}while(e!=0);
break;
}
else
{
system("cls");
//system("Color 1c");
cout<<"\n===========================THANKS FOR YOU===========================\n\n";
cout<<"\nYou had made your attempt which failed!!! No More attempts allowed!! Sorry!!\n\n";
cout<<"===========================THANKS===========================\n\n";
system("PAUSE");
exit (1);
}
//==================================================================================================
case 0://pin to access account
system("cls");
cout<<"\n==========================ATM ACCOUNT STATUS================================\n\n";
cout<<"\tYou must have the correct pin number to access this acount. See your\n\n";
cout<<"\t bank representative for assistance during bank opening hours\n\n";
cout<<"\t\tThanks for, your choice today!!\n\n";
cout<<"==========================ATM ACCOUNT STATUS================================\n\n";
system ("PAUSE");
exit(1);
break;
//==================================================================================================
}
system("PAUSE");
return 0;
};