-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTIED E-BANKING SYSTEM.cpp
More file actions
372 lines (357 loc) · 8.61 KB
/
TIED E-BANKING SYSTEM.cpp
File metadata and controls
372 lines (357 loc) · 8.61 KB
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
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
//WELCOME TO TIED E-BANKING SYSTEM
//Developed By...: The TIED Group
//
//Name: Mactilda Matsotso
//Reg No: 145187
//
//Name: Rutto Evans
//Reg No:139691
//
//Name: Dorry Omondi
//Reg No: 140351
//
//Submitted to : Mr.Kelvin Ndambuki
//Project Name :TIED Electronic Banking System
#include<iostream>
#include<string>
#include<sstream>
#include<windows.h>
#include<fstream>
using namespace std;
string Username,username,UN,un,Password,password,pw,PW;
int PRESS,CHOICE,out,press;
float deposit;
float withdraw;
float balance=0;
int choice;
string PASSWORD,pASSWORD,PSW,Psw;
fstream fin;
fstream fout;
int main()
{
int option;
bool successfullogin=false;
bool Success=false;
do{
cout <<"----------WELCOME TO TIED E-BANKING SYSTEM----------"<<endl;
cout<< " "<<endl;
cout <<" 1. Administrator. "<<endl;
cout <<" 2. Customer. "<<endl;
cout <<" 3. Exit."<<endl;
cout<< " "<<endl;
cout <<"------------------------------------------------------------------------"<<endl;
cout<< " "<<endl;
cout <<" Choose your option to proceed."<<endl;
cout <<" option:";
cin >>option;
system ("cls");// clear console
if(option==1)
{
cout <<"------------------------------------------------------------------------"<<endl;
cout<<" Welcome to Registration and Deposit page. "<<endl;
cout<< " "<<endl;
cout<<" Enter Administrator username and password."<<endl;
cout<< " "<<endl;
do{
cout<<" Enter username:";
cin >>Username;
cout<<" Enter password:";
cin>>Password;
fin.open("admin.txt");
fin>>UN;
fin>>PW;
fin.close();
if (Password==PW && Username==UN)
{
cout <<"------------------------------------------------------------------------"<<endl;
cout<< " welcome Admin ..."<<endl;
cout<< " "<<endl;
cout<<" 1. Register Customer."<<endl;
cout<<" 2. Deposit money for Customer."<<endl;
cout<<" 3. Reset password."<<endl;
cout<< " "<<endl;
cout <<"------------------------------------------------------------------------"<<endl;
successfullogin=true;
cout <<" Choose your option to proceed."<<endl;
cout <<" option:";
int choice;
cin>>choice;
system("cls");
switch(choice)
{
case 1:
{
cout <<"------------------------------------------------------------------------"<<endl;
cout<< " "<<endl;
cout<<" Welcome to registration page." <<endl;
cout<< " "<<endl;
cout <<" Input Customer's username: ";cin >>username;
cout <<" select a password for the Customer: ";cin>>password;
cout<<" "<<endl;
fout.open("Customer.txt");
fout<<username<<endl;
fout<<password<<endl;
fout<<balance<<endl;
fout.close();
cout<<"Registration successfully !!<<Username<<\n";
cout <<"------------------------------------------------------------------------"<<endl;
}
Sleep(200);
break;
Sleep(200);
case 2:
{
cout <<"------------------------------------------------------------------------"<<endl;
cout<< " "<<endl;
cout<<" Welcome to Deposit page." <<endl;
cout<< " "<<endl;
cout<<" Enter Amount to Deposit for a client: " ;
cin >>deposit;
balance += deposit;
fout.open("Customer.txt");
fout<<username<<endl;
fout<<password<<endl;
fout<<balance<<endl;
fout.close();
cout<<" "<<endl;
cout<<" Deposited successfully!"<<endl;
cout <<"------------------------------------------------------------------------"<<endl;
Sleep(200);
break;
}
case 3:
{
do{
cout <<"------------------------------------------------------------------------"<<endl;
cout<< " "<<endl;
cout <<" 1. Press 1 to Proceed to change your password."<<endl;
cout <<" 2. Press 2 to exit."<<endl;
cout<< " "<<endl;
cout<<" Option: ";
cin>>press;
system("cls");
switch (press)
{
case 1:
{
cout <<"------------------------------------------------------------------------"<<endl;
cout<< " "<<endl;
cout <<" Enter your current Password:"<<endl;
cout<<" Password: ";
cin>>PSW;
fin.open("admin.txt");
fin>>UN;
fin>>PW;
fin.close();
if ( PSW==PW)
{
cout <<" Enter your new password: ";
cin>>PASSWORD;
cout<<" Confirm your new password: ";
cin>>pASSWORD;
if (pASSWORD==PASSWORD)
{
PW=PASSWORD;
fout.open("admin.txt");
fout<<UN<<endl;
fout<<PW<<endl;
fout.close();
cout<< " "<<endl;
cout<< " Password changed successfully!"<<endl;
}
if( pASSWORD!=PASSWORD)
{
cout<<" your new password does not match!"<<endl;
}
}
else
{
cout <<" Invalid password"<<endl;
} }}
}while (press != 2) ;
}
Sleep(200);
break;
}
}
else
{
cout<< " "<<endl;
cout <<"Invalid Password or Username ,Please try again."<<endl;
cout<< " "<<endl;
}
}while (!successfullogin);
}
else if (option==2)
{
do{
cout <<"------------------------------------------------------------------------"<<endl;
cout<< " "<<endl;
cout <<" 1. Press 1 to Proceed to login."<<endl;
cout <<" 2. Press 2 exit."<<endl;
cout<< " "<<endl;
cout<<" Option: ";
cin>>out;
switch(out)
{
case 1:
{
cout <<"------------------------------------------------------------------------"<<endl;
cout<< " "<<endl;
cout<<" ***********Welcome to Customer login page. "<<endl;
cout<< " "<<endl;
cout<<" Enter username and password."<<endl;
do{
cout<<" Enter username:";
cin >> username;
cout<<" Enter password:";
cin>>password;
fin.open("Customer.txt");
fin>>un;
fin>>pw;
fin.close();
if ( username==un && password==pw )
{
cout <<"------------------------------------------------------------------------"<<endl;
cout<< " Welcome Our Customer. "<<endl;
cout<< " "<<endl;
cout<<" 1. Withdraw Cash."<<endl;
cout<<" 2. Check Account balance."<<endl;
cout<<" 3. Reset password."<<endl;
cout<< " "<<endl;
cout <<"------------------------------------------------------------------------"<<endl;
Success=true;
cout<< " "<<endl;
cout <<" Choose your option to proceed."<<endl;
cout <<" Option:";
int choice;
cin>>choice;
switch(choice)
{
case 1:
{
do{
cout <<"------------------------------------------------------------------------"<<endl;
cout <<" 1. Press 1 to Proceed to withdraw."<<endl;
cout <<" 2. Press 2 exit."<<endl;
cout<< " "<<endl;
cout<<" Option: ";
Sleep(200);
cin>>PRESS;
system("cls");
switch (PRESS) {
case 1: {
cout <<" Enter amount to Withdraw: "<<endl;
cin >>withdraw;
Sleep(200);
if(withdraw <= balance )
{
balance-=withdraw;
fout.open("Customer.txt");
fout<<username<<endl;
fout<<password<<endl;
fout<<balance<<endl;
fout.close();
cout<<" withdrawal succesful! You balance is:"<<balance <<endl;
}
else{
cout<<"Dear "<<username<<" you have Insufficient funds in your account to withdraw :"<<withdraw<< " Please check your balance and try again. "<<endl;
}}
break;
}
}while(PRESS != 2);
}
break;
case 2:
{
do{
cout <<"------------------------------------------------------------------------"<<endl;
cout<< " "<<endl;
cout <<" 1. Press 1 to check your balance."<<endl;
cout <<" 2. Press 2 exit."<<endl;
cout<<" Option: ";
cin>>CHOICE;
system ("cls");
switch (CHOICE)
{
case 1:
{
cout<<"your balance is: ";
cout<<balance<<endl;
}
break;
}
}while(CHOICE != 2);
}
break;
case 3:
{
do{
cout <<"------------------------------------------------------------------------"<<endl;
cout<< " "<<endl;
cout <<" 1. Press 1 to Proceed to change your password."<<endl;
cout <<" 2. Press 2 exit."<<endl;
cout<<" Option: ";
cin>>press;
system("cls");
switch (press)
{
case 1:
cout <<"Kindly input your current Password:"<<endl;
cout<< " "<<endl;
cout<<"Password: ";
cin>>pw;
if ( pw==password)
{
cout <<" Enter your new password: ";
cin>>PSW;
system("cls");
cout<<" Confirm your new password: ";
cin>>Psw;
if (PSW==Psw);
{
pw=Psw;
fout.open("Customer.txt");
fout<<un<<endl;
fout<<pw<<endl;
fout<<balance<<endl;
fout.close();
cout<< " Password changed successfully!!";
}
if(PSW !=Psw)
{
cout<<" your new password does not match please try again!";
}
}
else
{
cout <<"Invalid password";
}
}
break;
}while (press !=2);
}
break;
}
}
else
{
cout<< " "<<endl;
cout <<"Make sure you are registered in the system."<<endl;
cout<< " "<<endl;
cout<<"Invalid Password or Username Please try again!"<<endl;
cout << "\n\n";
system("PAUSE");
Sleep(500);
cout<< "***Thank you for being TIEDS' Customer**** "<<endl;
}
}while (!Success);
}
break;
}
}while(out != 2);
}
}while (option !=3);
return 0;
}
//******END OF PROJECT*****//