-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproject.cpp
More file actions
440 lines (423 loc) · 12.6 KB
/
project.cpp
File metadata and controls
440 lines (423 loc) · 12.6 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
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
#include<iostream>
#include<fstream>
#include<unistd.h>
using namespace std;
class bank_holder
{
private:
char name[40];
char address[50];
long long int phn_no;
char d_o_b[12];
char today_date[12];
char addhar_no[20];
long int acc_no;
long int bank_bal;
long int pass;
long int loan;
long int FD;
long int RL;
public:
bank_holder()
{
bank_bal=0;
loan=0;
FD=0;
RL=0;
}
void create_acc();
void acc_holder_details();
void deposit();
void withdrawal();
void balance_enq();
void prt_passbook();
void easy_loan();
void update_acc();
void delete_acc();
void fixed_deposit();
void return_loan();
};
void bank_holder::create_acc()
{
int p,t;
fflush(stdin);
cout<<"\n\t\tENTER TODAY'S DATE (*DD/MM/YYYY) : ";
cin.getline(today_date,12);
cout<<"\n\t\tENTER COUSTMER NAME (*only capital letters) : ";
cin.getline(name,40);
cout<<"\n\t\tENTER YOUR PERMENANT ADDRESS : ";
cin.getline(address,50);
fflush(stdin);
cout<<"\n\t\tENTER YOUR PHONE NUMBER : ";
cin>>phn_no;
fflush(stdin);
cout<<"\n\t\tENTER YOUR DATE OF BIRTH (*DD/MM/YYYY) : ";
cin.getline(d_o_b,12);
fflush(stdin);
cout<<"\n\t\tENTER YOUR ADDHAR NUMBER (*xxxx xxxx xxxx) : ";
cin.getline(addhar_no,20);
fflush(stdin);
do
{
cout<<"\n\t\tSET YOUR PASSWORD (*4 digit number) : ";
cin>>p;
cout<<"\n\t\tCONFIRM YOUR PASSWORD : ";
cin>>t;
if(p==t)
{
pass=p;
break;
}
cout<<"\n\t\tSOMETHING WENT WRONG !!!";
}
while(p!=t);
acc_no=phn_no/19;
}
void bank_holder::acc_holder_details()
{
int key;
cout<<"\n\t\t>ENTER YOUR SIGNATURE (*password) : ";
cin>>key;
if(key==pass)
{
cout<<"\n\n\t\t___________BANK HOLDER DETAILS___________\n";
cout<<"\n\t\t>CUSTOMER NAME : "<<name;
cout<<"\n\t\t>ACCOUNT NUMBER : "<<acc_no;
cout<<"\n\t\t>ISSUED DATE : "<<today_date;
cout<<"\n\t\t>CONTACT NUMBER : "<<phn_no;
cout<<"\n\t\t>ADDRESS : "<<address;
cout<<"\n\t\t>DATE OF BIRTH : "<<d_o_b;
cout<<"\n\t\t>ID PROOF(*addhar number) : "<<addhar_no;
cout<<"\n\t\t>loan : "<<loan;
cout<<"\n\t\t>FIXED DEPOSIT : "<<FD;
}
else
{
cout<<"\n\n\t\tXXX ENTERED WRONG SIGNATURE XXX";
cout<<"\n\t\t TRY AGAIN!!!";
}
}
void bank_holder::deposit()
{
int chs;
long int t;
cout<<"\n\n\t___________CHOOSE ACCOUNT TYPE___________\n";
cout<<"\n\t>1.SAVINGS\n\t>2.CURRENT\n\t>";
cin>>chs;
cout<<"\n\t>ENTER AMOUNT TO BE DEPOSITED : ";
cin>>t;
bank_bal=bank_bal+t;
cout<<"\n\n\tDEPOSIT SUCCESSFULL!!!";
cout<<"\n\tTHANK YOU!!!(*you will get 5% interest/year.)";
ofstream fout;
fout.open("BANK_HOLDER_DETAILS.txt",ios::app);
fout<<"\n\n\t\t"<<"*DEPOSIT = "<<t<<"\t"<<"*WITHDRAW = "<<"-"<<"\t*BALANCE = "<<bank_bal<<endl;
fout.close();
}
void bank_holder::withdrawal()
{
float w;
int key;
cout<<"\n\n\t\t___________WITHDRAWAL___________\n";
cout<<"\n\t\t>ENTER AMOUNT TO BE WITHDRAW : ";
cin>>w;
cout<<"\n\t\t>ENTER YOUR SIGNATURE (*password) : ";
cin>>key;
if(key==pass)
{
if(w<=bank_bal)
{
bank_bal=bank_bal-w;
cout<<"\n\t\t>WITHDRAWL SUCCESSFULL!!!";
ofstream fout;
fout.open("BANK_HOLDER_DETAILS.txt",ios::app);
fout<<"\n\t\t"<<"*DEPOSIT = "<<"-\t"<<"*WITHDRAW = "<<w<<"\t*BALANCE = "<<bank_bal<<endl;
fout.close();
}
else
{
cout<<"\n\t\t>XXX WITHDRAWL UNSUCCESSFULL!!! XXX";
cout<<"\n\t\t ......OUT OF CASH.........";
cout<<"\n\t\t TRY AGAIN!!!";
}
}
else
{
cout<<"\n\n\t\tXXX ENTERED WRONG SIGNATURE XXX";
cout<<"\n\t\t TRY AGAIN!!!";
}
}
void bank_holder::balance_enq()
{
int key;
cout<<"\n\n\t\t___________BANK BALANCE DETAIL___________\n";
cout<<"\n\t\t>ENTER YOUR SIGNATURE (*password) : ";
cin>>key;
if(key==pass)
{
cout<<"\n\t\t>BANK BALANCE : "<<bank_bal;
cout<<"\n\t\t>INTEREST(*5%) : "<<(float)bank_bal*.05;
}
else
{
cout<<"\n\n\t\tXXX ENTERED WRONG SIGNATURE XXX";
cout<<"\n\t\t TRY AGAIN!!!";
}
}
void bank_holder::prt_passbook()
{
char ch;
ifstream fin;
fin.open("BANK_HOLDER_DETAILS.txt",ios::in);
cout<<"\n\n\t\t________________TRANSACTIONS_________________\n";
while(!fin.eof())
{
ch=fin.get();
cout<<ch;
}
fin.close();
}
void bank_holder::easy_loan()
{
if(loan==0)
{
cout<<"\n\t\t>[1].Car loan\n\t\t>[2].Home loan :";
int e;
cin>>e;
if(e==1)
{
cout<<"\n\n\t\t___________CAR LOAN___________\n\n";
cout<<"\t\tYOU HAVE TO GIVE 10% INTEREST ON CAR LOAN\n";
int c;
cout<<"\t\t >[1].YES\n\t\t >[2].NO :";
cin>>c;
if(c==1)
{
cout<<"\n\t\t>HOW MUCH LOAN DO YOU WANT (in Rs.) : ";
cin>>loan;
cout<<"\n\t\tYour loan is approved \n";
cout<<"\t\tYou have taken loan of Rs. "<<loan;
cout<<"\n\t\tYOU HAVE TO RETURN "<<loan + loan*0.10<<" Rs.\n";
}
else
{
cout<<"\n\t\tSORRY\n";
}
}
else if(e==2)
{
cout<<"\n\n\t\t___________HOME LOAN___________\n\n";
cout<<"\t\tYOU HAVE TO GIVE 7% INTEREST ON HOME LOAN\n";
int c;
cout<<"\t\t >[1].YES\n\t\t >[2].NO :";
cin>>c;
if(c==1)
{
cout<<"\n\t\t>HOW MUCH LOAN DO YOU WANT (in Rs.) : ";
cin>>loan;
cout<<"\n\t\tYour loan is approved \n";
cout<<"\t\tYou have taken loan of Rs. "<<loan;
cout<<"\n\t\tYOU HAVE TO RETURN "<<loan + loan*0.07<<" Rs.\n";
}
else
{
cout<<"\n\t\tSORRY\n";
}
}
else
{
cout<<"\n\n\t\tPLEASE,ENTER CORRECT CHOICE !!!";
}
}
else
{
cout<<"\n\n\t\t SORRY !!!";
cout<<"\n\n\t\t YOU HAVE ALREADY TAKEN LOAN !!!";
}
}
void bank_holder::return_loan()
{
if(loan!=0)
{
cout<<"\n\n\t\t___________RETURN LOAN___________\n\n";
cout<<"\t\tHOW MUCH LOAN DO YOU WANT RETURN : ";
cin>>RL;
if(RL==loan)
{
cout<<"\n\t\tYOU HAVE RETURN ALL LOAN OF Rs. "<<RL;
cout<<"\n\n\t\t THANK YOU !!!";
loan=0;
}
else if(RL<loan)
{
cout<<"\n\t\tYOU HAVE RETURN LOAN OF Rs. "<<RL;
cout<<"\n\t\tNOW YOU HAVE TO RETURN LOAN OF Rs. "<<loan-RL;
loan=loan-RL;
cout<<"\n\n\t\t THANK YOU !!!";
}
}
}
void bank_holder::fixed_deposit()
{
int f;
cout<<"\n\n\t\t___________FIXED DEPOSIT___________\n\n";
cout<<"\t\tFOR HOW MUCH YEAR YOU WANT TO DO FIXED DEPOSIT \n";
cout<<"\t\t>[5]\n\t\t>[10] :";
cin>>f;
if(f==5)
{
cout<<"\n\t\tHOW MUCH MONEY YOU WANT TO SAVE IN FIXED DEPOSIT :";
cin>>FD;
cout<<"\n\t\tYOUR FIXED DEPOSIT IS APPROVED";
cout<<"\n\t\t"<<FD ;
cout<<"Rs. SAVED ON YOUR FIXED DEPOSIT\n";
cout<<"\t\tYOU WILL GET "<<FD+FD*0.07<<" Rs. AFTER 5 YEARS\n";
}
else if(f==10)
{
cout<<"\n\t\tHOW MUCH MONEY YOU WANT TO SAVE IN FIXED DEPOSIT :";
cin>>FD;
cout<<"\n\t\tYOUR FIXED DEPOSIT IS APPROVED";
cout<<"\n\t\t"<<FD ;
cout<<"Rs. SAVED ON YOUR FIXED DEPOSIT\n";
cout<<"\t\tYOU WILL GET "<<FD+FD*0.08<<" Rs. AFTER 10 YEARS\n";
}
else
{
cout<<"\n\t\tCHOOSE A CORRECT OPTION\n";
}
}
void bank_holder::update_acc()
{
int ch,key;
acc_holder_details();
cout<<"\n\n\t\t==== ENTER WHAT YOU WANT TO CHANGE ====";
cout<<"\n\t\t[1].NAME\n\t\t[2].PHONE NUMBER\n\t\t[3].ADDRESS\n\t\t[4].DATE OF BRTH\n\t\t";
cin>>ch;
cout<<"\n\t\t>ENTER YOUR SIGNATURE (*password) : ";
cin>>key;
if(key==pass)
{
switch (ch)
{
case 1:
fflush(stdin);
cout<<"\n\t\tENTER COUSTMER NAME(*only capital letters) : ";
cin.getline(name,40);
break;
case 2:
fflush(stdin);
cout<<"\n\t\tENTER YOUR PHONE NUMBER : ";
cin>>phn_no;
break;
case 3:
fflush(stdin);
cout<<"\n\t\tENTER YOUR PERMENANT ADDRESS : ";
cin.getline(address,50);
break;
case 4:
fflush(stdin);
cout<<"\n\t\tENTER YOUR DATE OF BIRTH : ";
cin.getline(d_o_b,12);
break;
default:
fflush(stdin);
cout<<"\n\t\tXXX ENTER WRONG CHOISE XXX";
cout<<"\n\t\t TRY AGAIN !!!";
}
}
else
{
cout<<"\n\n\t\tXXX ENTERED WRONG SIGNATURE XXX";
cout<<"\n\t\t TRY AGAIN !!!";
}
}
void bank_holder::delete_acc()
{
int key;
cout<<"\n\n\t\t==== ACCOUNT DELETION ====";
cout<<"\n\t\t>ENTER YOUR SIGNATURE (*password) : ";
cin>>key;
if(key==pass)
{
cout<<"\n\n\t\t YOUR ACCOUNT IS DELETED !!!";
cout<<"\n\n\t\t THANK YOU !!!";
exit(1);
}
else
{
cout<<"\n\n\t\tXXX ENTERED WRONG SIGNATURE XXX";
cout<<"\n\t\t TRY AGAIN !!!";
}
}
int main()
{
bank_holder b;
int ch;
cout<<"\n\n\n\n\n\t\t--------- ---------\n";
cout<<"\t\t=========== WELCOME TO SBI !!! ==========\n";
cout<<"\t\t--------- ---------\n\n\n";
sleep(2);
do
{
cout<<"\n\n\n\t\tHOW CAN WE HELP YOU ?\n\n\t\t>[1].CREATE ACCOUNT\n\t\t>[2].ACCOUNT HOLDER DETAILS\n\t\t>[3].DEPOSIT MONEY\n\t\t>[4].BALANCE ENQUIRY\n\t\t>[5].WITHDRAWAL\n\t\t>[6].TRANSACTIONS";
cout<<"\n\t\t>[7].QUICK LOAN\n\t\t>[8].RETURN LOAN\n\t\t>[9].FIXED DEPOSIT\n\t\t>[10].UPDATE ACCOUNT DETAILS\n\t\t>[11].DELETE ACCOUNT\n\t\t>[12].EXIT.\n\n\t\tENTER YOUR CHOICE :";
cin>>ch;
switch(ch)
{
case 1:
system("CLS");
b.create_acc();
break;
case 2:
system("CLS");
b.acc_holder_details();
break;
case 3:
system("CLS");
b.deposit();
break;
case 4:
system("CLS");
b.balance_enq();
break;
case 5:
system("CLS");
b.withdrawal();
break;
case 6:
system("CLS");
b.prt_passbook();
break;
case 7:
system("CLS");
b.easy_loan();
break;
case 8:
system("CLS");
b.return_loan();
break;
case 9:
system("CLS");
b.fixed_deposit();
break;
case 10:
system("CLS");
b.update_acc();
break;
case 11:
system("CLS");
b.delete_acc();
break;
case 12:
system("CLS");
cout<<"\t\t--------- ---------\n";
cout<<"\t\t=========== THANK YOU !!! ===========\n";
cout<<"\t\t--------- ---------\n\n\n";
exit(1);
default:
cout<<"\n\n\t\tPLEASE,ENTER CORRECT CHOISE !!!";
}
}
while(ch!=12);
}