-
Notifications
You must be signed in to change notification settings - Fork 0
/
bankingmanagment.c
827 lines (798 loc) · 45.4 KB
/
bankingmanagment.c
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
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <conio.h>
int ac_1 = 5738321;
int cust_no = 100, cust_avail = 0;
char admin_user[10] = "admin123";
char admin_pass[20] = "adminpass123";
int infinity = 0;
// structure of customers data
struct data
{
int srno;
int ac;
char name[30];
char phone[10];
char pass[20];
int age;
char pan[10];
float balance;
// credit score
int credit_s;
float loan_amt;
float emi;
float bull_pay;
float fd;
} d[100];
// BANK DEPOSIT RECIEPT
void deposit_reciept(int ac, int deposit)
{
printf("*****************************************\n");
printf("* S.A.S BANK *\n");
printf("*****************************************\n");
printf("* *\n");
printf("* Deposit Reciept *\n");
printf("* *\n");
printf("* Account Number: %d \n", ac);
printf("* Ammount deposited: Rs.%d \n", deposit);
printf("* *\n");
printf("*****************************************\n");
}
// CASH WITHDRAWAL RECIEPT
void withdraw_reciept(int ac, int withdrawal)
{
printf("*****************************************\n");
printf("* S.A.S BANK *\n");
printf("*****************************************\n");
printf("* *\n");
printf("* Withdrawal Reciept *\n");
printf("* *\n");
printf("* Account Number: %d\n", ac);
printf("* Withdrawal Amount: Rs.%d\n", withdrawal);
printf("* *\n");
printf("*****************************************\n");
}
// MONEY TRANSFER RECIEPT
void transfer_reciept(int sender_ac, int reciever_ac, int amount, char *bank_name)
{
printf("*****************************************\n");
printf("* S.A.S BANK *\n");
printf("*****************************************\n");
printf("* *\n");
printf("* Transfer Reciept *\n");
printf("* *\n");
printf("* Sender Account Number: %d\n", sender_ac);
printf("* Reciever Account Number: %d\n", reciever_ac);
printf("* Withdrawal Amount: Rs.%d\n", amount);
printf(" Bank of reciever: %s", bank_name);
printf("* *\n");
printf("*****************************************\n");
}
// TO CHECK PRESENCE OF ACCOUNT NUMBER
int check_ac(int ac)
{
for (int i = 0; i < cust_avail; i++)
{
if (ac == d[i].ac)
{
return i + 1;
}
}
return 0;
}
// TO CHECK ACCOUNT NUMBER AND PASSWORD OF CUSTOMER
int check_pass()
{
int ac_try;
char pass_try[20];
printf(" Enter account no");
scanf("%d", &ac_try);
printf("\n Enter your password");
scanf("%s", pass_try);
int i;
for (i = 0; i < cust_avail; i++)
{
if (ac_try == d[i].ac)
{
if (strcmp(pass_try, d[i].pass) == 0)
return i;
}
}
return -1;
}
// TO SEARCH ACCOUNT NUMBER
int check_ac_search()
{
int ac_try;
printf(" Enter account no to search user: ");
scanf("%d", &ac_try);
for (int i = 0; i <= cust_avail; i++)
{
if (ac_try == d[i].ac)
{
return i;
}
}
return -1;
}
// MAIN FUNCTION
int main()
{
// SAMPLE DATA OF 10 CUSTOMERS
for (int i = 0; i < 10; i++)
{
d[i].srno = i + 1;
d[i].ac = 5738121 + i * 13;
// name
// pan
d[i].age = rand() % 50;
d[i].balance = 5000 + rand() % 1000000;
// phone
d[i].credit_s = 400 + rand() % 500;
d[i].loan_amt = 0;
d[i].emi = 0;
d[i].bull_pay = 0;
d[i].fd = 10000 * rand() % 10;
cust_avail++;
}
strcpy(d[0].name, "Aarush");
strcpy(d[1].name, "Shiva");
strcpy(d[2].name, "Saksham");
strcpy(d[3].name, "Shivam");
strcpy(d[4].name, "Raghav");
strcpy(d[5].name, "Anant");
strcpy(d[6].name, "Vivek");
strcpy(d[7].name, "Saran");
strcpy(d[8].name, "Yash");
strcpy(d[9].name, "Kabir");
strcpy(d[0].pan, "234567");
strcpy(d[1].pan, "234568");
strcpy(d[2].pan, "234569");
strcpy(d[3].pan, "345678");
strcpy(d[4].pan, "345679");
strcpy(d[5].pan, "123456");
strcpy(d[6].pan, "987654");
strcpy(d[7].pan, "345671");
strcpy(d[8].pan, "134657");
strcpy(d[9].pan, "453678");
strcpy(d[0].phone, "9897775154");
strcpy(d[1].phone, "9897775458");
strcpy(d[2].phone, "7544841158");
strcpy(d[2].phone, "7854447185");
strcpy(d[3].phone, "9898556247");
strcpy(d[4].phone, "5652184515");
strcpy(d[5].phone, "3958845665");
strcpy(d[6].phone, "5572484826");
strcpy(d[7].phone, "9898769432");
strcpy(d[8].phone, "7483195747");
strcpy(d[9].phone, "8383256569");
// MENU DRIVEN PROGRAM
while (infinity == 0)
{
int choice1;
printf(" _______________________________________________________________________________\n");
printf("| |\n");
printf("| |\n");
printf("| SAS BANK |\n");
printf("| |\n");
printf("| |\n");
printf("| Welcome to SAS BANK |\n");
printf("| ----------> |\n");
printf("| |\n");
printf("| |\n");
printf("| ENTER YOUR CHOICE: |\n");
printf("| |\n");
printf("| 1. LOGIN |\n");
printf("| 2. NEW CUSTOMER? |\n");
printf("| 3. ADMIN LOGIN PAGE |\n");
printf("| |\n");
printf("| 4. CLOSE APPLICATION |\n");
printf("| |\n");
printf("|_______________________________________________________________________________|\n");
scanf("%d", &choice1);
// LOGIN
if (choice1 == 1)
{
int try_cust = 0;
int counter = check_pass();
if (counter == -1)
{
int check;
printf("Wrong username or password, Try again....\nY-->1\nN-->2");
scanf("%d", &check);
if (check == 1)
check_pass();
else
{
break;
}
}
while (infinity == 0)
{
int choice_log;
printf(" _______________________________________________________________________________\n");
printf("| |\n");
printf("| SAS BANK |\n");
printf("| Welcome %s 8. Logout \n", d[counter].name);
printf("| Account Number: %d \n", d[counter].ac);
printf("| |\n");
printf("| ----------> |\n");
printf("| |\n");
printf("| |\n");
printf("| ENTER YOUR CHOICE: |\n");
printf("| |\n");
printf("| 1. My account details |\n");
printf("| 2. Deposit |\n");
printf("| 3. Withdrawal |\n");
printf("| 4. Money Transfer |\n");
printf("| 5. Loan Application |\n");
printf("| 6. Loan Repayment |\n");
printf("| 7. Set Up Fixed deposit |\n");
printf("| |\n");
printf("|_______________________________________________________________________________|\n");
fflush(stdin);
scanf("%d", &choice_log);
// my account details
if (choice_log == 1)
{
printf(" _______________________________________________________________________________\n");
printf("| \n");
printf("| SAS BANK \n");
printf("| Welcome %s 1. Back \n", d[counter].name);
printf("| Account Number: %d \n", d[counter].ac);
printf("| \n");
printf("| Assets \n");
printf("| Balance: %f \n", d[counter].balance);
printf("| F.D: %f \n", d[counter].fd);
printf("| \n");
printf("| Liabilities \n");
printf("| Loan: %f \n", d[counter].loan_amt);
printf("| E.M.I on Loan: %f \n", d[counter].emi);
printf("| \n");
printf("| \n");
printf("| Edit your personal details \n");
printf("| \n");
printf("|_______________________________________________________________________________\n");
}
// Deposit
else if (choice_log == 2)
{
float dep_amt;
printf("_____________________________________________________________\n");
printf(" S.A.S BANK \n");
printf(" Enter the amount you want to deposit:");
scanf("%f", &dep_amt);
d[counter].balance = d[counter].balance + dep_amt;
int dep_reciept;
printf("\n\nDo you want to print the deposit reciept\nY-->1\nN-->2:");
scanf("%d", &dep_reciept);
if (dep_reciept == 1)
{
deposit_reciept(d[counter].ac, dep_amt);
}
}
// withdrawal
else if (choice_log == 3)
{
float with_amt;
printf("_____________________________________________________________\n");
printf(" S.A.S BANK \n");
printf(" ENTER THE AMOUNT YOU WANT TO WITHDRAW :");
scanf("%f", &with_amt);
d[counter].balance = d[counter].balance - with_amt;
withdraw_reciept(d[counter].ac, with_amt);
}
// Money Transfer
else if (choice_log == 4)
{
int choice_transfer;
printf(" _______________________________________________________________________________\n");
printf("| |\n");
printf("| SAS BANK |\n");
printf("| Welcome %s \n", d[counter].name);
printf("| Account Number: %d \n", d[counter].ac);
printf("| MONEY TRANSFER WINDOW |\n");
printf("| ----------> |\n");
printf("| |\n");
printf("| 1. Transfer to account in S.A.S Bank |\n");
printf("| 2. Transfer to account in another bank |\n");
printf("| 3. Exit window |\n");
printf("| |\n");
printf("|_______________________________________________________________________________|\n");
scanf("%d", &choice_transfer);
// transfer to a/c in SAS bank
if (choice_transfer == 1)
{
int yn;
int reciever_ac;
char bank_name[10] = "S.A.S BANK";
printf("__________________________________________________________\n");
printf(" Enter Account number of Reciever:");
scanf("%d", &reciever_ac);
for (int i = 0; i < cust_avail; i++)
{
// TO FIND RECIEVER ACCOUNT IN S.A.S BANK
if (check_ac(reciever_ac) == 0)
{
// IF ACCOUNT NOT PRESENT IN DATA
printf("******** Account not present in Bank *********");
printf(" Do you want to enter reciver account number again....");
printf("Y->1 N->0\n");
scanf("%d", &yn);
if (yn != 1)
{
break;
}
}
else
{
float amt_transfer;
printf(" Enter amount to be transferred:");
scanf("%f", &amt_transfer);
if (amt_transfer <= d[counter].balance)
{
printf(" Processing....");
printf("\n\n\n");
d[counter].balance = d[counter].balance - amt_transfer;
d[check_ac(reciever_ac) - 1].balance += amt_transfer;
transfer_reciept(d[counter].ac, reciever_ac, amt_transfer, bank_name);
}
else
{
// MONEY TRANSFER FAILED IF AMOUNT ENTERED IS LESS THAN BALANCE
printf(" Money cannot be transferred.\n Account balance low");
printf("Y->1 N->0\n");
scanf("%d", &yn);
if (yn != 1)
{
break;
}
}
}
}
}
// transfer to a/c outside SAS bank
else if (choice_transfer == 2)
{
while (infinity == 0)
{
int yn;
int reciever_ac;
float amt_transfer;
char bank_name[10];
printf("__________________________________________________________\n");
printf(" Enter Account number of Reciever:");
scanf("%d", &reciever_ac);
printf(" Enter Bank Name:");
scanf("%s", bank_name);
printf(" Enter amount to be transferred:");
scanf("%f", &amt_transfer);
if (amt_transfer <= d[counter].balance)
{
printf("Processing....");
printf("\n\n\n");
d[counter].balance = d[counter].balance - amt_transfer;
transfer_reciept(d[counter].ac, reciever_ac, amt_transfer, bank_name);
break;
}
else
{
printf(" Money cannot be transferred.\n Account balance low");
printf("Y->1 N->0\n");
scanf("%d", &yn);
if (yn != 1)
{
break;
}
}
}
}
// Exit window
else if (choice_transfer == 3)
{
break;
}
}
// Loan Application
else if (choice_log == 5)
{
if (d[counter].loan_amt > d[counter].balance * 20)
{
// IF USER ALREADY HAS A LOAN ON THEMSELVES
printf("You cannot get furthur loans as you already have a loan of Rs. %d", d[counter].loan_amt);
break;
}
float loan_app = 1, max_loan = 0;
int repayment;
printf(" _________________________________________________________________\n");
printf("| S.A.S BANK \n");
printf("| \n");
printf("| LOAN APPLICATION \n");
printf("| \n");
printf("| Your credit score is %d \n", d[counter].credit_s);
printf("\n");
while (loan_app > max_loan)
{
printf("| Enter loan amount:");
scanf("%f", &loan_app);
int T; // T-->time period
printf("|\n");
printf("| Enter Time Period in months:");
scanf("%d", &T);
printf("| |\n");
printf("|_____________________________________________________________|\n");
max_loan = (d[counter].credit_s * d[counter].balance) / 100 - d[counter].loan_amt;
if (loan_app <= max_loan)
{
printf("LOAN APPROVED\n");
printf("Choose Repayment Option:\n");
printf("1.EMI\n");
printf("2.Bullet Payment\n");
d[counter].loan_amt += loan_app + (loan_app * 1.5 * T) / 100;
scanf("%d", &repayment);
// EMI
if (repayment == 1)
{
d[counter].emi += (loan_app + (1.5 / 100 * loan_app) * T) / T;
printf("Your EMI: %f\n", d[counter].emi);
}
// BULLET PAYMENT
else if (repayment == 2)
{
float bullet_pay = (d[counter].loan_amt * 1.5 * T) / 100;
d[counter].bull_pay += bullet_pay;
printf("Your Bullet repayment amount:%f you have to pay it in %d months\n", bullet_pay, T);
}
}
else
{
// LOAN FAILED DUE TO UNSATISFIED REQUIREMENTS
printf("LOAN CANNOT BE APPROVED DUE TO LOW CREDIT SCORE AND BALANCE \n");
}
}
}
// Loan Repayment
if (choice_log == 6)
{
printf("_______________________________________________________________________________\n");
printf(" S.A.S BANK\n");
printf("\n");
printf(" LOAN REPAYMENT PLANS\n");
printf("\n");
printf(" Total Loan Amount Left: %f\n", d[counter].loan_amt);
if (d[counter].emi != 0)
printf(" EMI for each month to be paid is: %f\n", d[counter].emi);
if (d[counter].bull_pay != 0)
{
printf(" Bullet payment to be made is: %f\n", d[counter].emi);
}
if (d[counter].emi != 0 && d[counter].bull_pay != 0)
{
printf(" What mode do you want to pay\n");
printf(" 1. EMI\n");
printf(" 2. Bullet Payment\n");
int rep_choice;
scanf("%d", &rep_choice);
if (rep_choice == 1)
{
if (d[counter].balance < d[counter].emi)
{
printf(" Insufficient Funds\n");
}
else
{
printf(" Paying %f towards EMI from A/c %d", d[counter].emi, d[counter].ac);
d[counter].balance -= d[counter].emi;
}
}
else if (rep_choice == 2)
{
if (d[counter].balance < d[counter].bull_pay)
{
printf(" Insufficient Funds\n");
}
else
{
printf(" Paying %d towards bullet payment from A/c %d", d[counter].bull_pay, d[counter].ac);
d[counter].balance -= d[counter].bull_pay;
}
}
}
if (d[counter].emi != 0 && d[counter].bull_pay == 0)
{
if (d[counter].balance < d[counter].emi)
{
printf(" Insufficient Funds\n");
}
else
{
printf(" Paying %d towards EMI from A/c %d", d[counter].emi, d[counter].ac);
d[counter].balance -= d[counter].emi;
}
}
if (d[counter].emi == 0 && d[counter].bull_pay != 0)
{
if (d[counter].balance < d[counter].bull_pay)
{
printf(" Insufficient Funds\n");
}
else
{
printf(" Paying %d towards bullet payment from A/c %d", d[counter].bull_pay, d[counter].ac);
d[counter].balance -= d[counter].bull_pay;
}
}
printf("_______________________________________________________________________________\n");
}
// Set Up Fixed deposit
if (choice_log == 7)
{
int month = 0;
float final_amt, fd_amt;
printf(" _______________________________________________________________________________\n");
printf("| |\n");
printf("| THANKS FOR SHOWING INTEREST IN F.D |\n");
printf("| |\n");
printf("| ****WE PROVIDE GREAT INTEREST RATES ON YOUR DEPOSITS**** |\n");
printf("| |\n");
printf("| OUR INTEREST RATES ARE GIVEN BELOW : |\n");
printf("| |\n");
printf("| |\n");
printf("| FOR 6-12 MONTH ----> 5%% |\n");
printf("| |\n");
printf("| FOR 12-18 MONTH ----> 6%% |\n");
printf("| |\n");
printf("| FOR MORE THAN 18 MONTH ----> 7%% |\n");
printf("| |\n");
printf("| |\n");
printf("| *T&C- Minimum term of 6 months required to set up an F.D. |\n");
printf("| |\n");
printf("|_______________________________________________________________________________|\n\n\n");
printf("ENTER HOW MUCH MONEY YOU WANT TO DEPOSIT :");
fflush(stdin);
scanf("%f", &fd_amt);
while (month < 6)
{
printf("FOR HOW MUCH PERIOD YOU WANT TO MAKE F.D :");
scanf("%d", &month);
// FOR LESS THAN 12 MONTHS
if (month < 12 && month >= 6)
{
final_amt = fd_amt + (fd_amt * 5 * (month / 12) / 100);
printf("YOUR DEPOSITED MONEY WILL BECOME %f IN %d MONTHS", final_amt, month);
d[counter].fd += final_amt;
}
// FOR LESS THAN 18 MONTHS
else if (month >= 12 && month < 18)
{
final_amt = fd_amt + (fd_amt * 6 * (month / 12) / 100);
printf("YOUR DEPOSITED MONEY WILL BECOME %f IN %d MONTHS", final_amt, month);
d[counter].fd += final_amt;
}
// FOR GREATER THAN 18 MONTHS
else if (month >= 18)
{
final_amt = fd_amt + (fd_amt * 7 * (month / 12) / 100);
printf("YOUR DEPOSITED MONEY WILL BECOME %f IN %d MONTHS", final_amt, month);
d[counter].fd += final_amt;
}
// IF TIME ENTERED IS LESS THAN 6 MONTHS
else
{
printf("YOUR F.D TENURE IS TOO SMALL. ONLY MORE THAN 6 MONTHS F.D ARE ALLOWED");
}
printf("\n");
}
}
// LOGOUT
else if (choice_log == 8)
{
printf(" S.A.S BANK \n");
printf(" Thanks for operating your account\n");
printf(" We will see you soon\n");
break;
}
}
}
// New customer?
else if (choice1 == 2)
{
float entered_bal = 0;
d[cust_avail].balance = 0;
printf("\n\n\n\n");
printf(" ________________________________________________________________________\n");
printf("| ***** WELCOME TO S.A.S BANK ***** |\n");
printf("| |\n");
printf("| Let's get you started |\n");
printf("| |\n");
printf("| Enter your mobile number:");
scanf("%s", d[cust_avail].phone);
printf("| |\n");
printf("| Enter a new password:");
scanf("%s", d[cust_avail].pass);
printf("| |\n");
printf("| Enter your full name:");
scanf("%s", d[cust_avail].name);
printf("| |\n");
printf("| Enter your Age:");
scanf("%d", &d[cust_avail].age);
printf("| |\n");
printf("| Enter your Pancard number:");
scanf("%s", d[cust_avail].pan);
printf("| |\n");
printf("| Enter your CIBIL score:");
scanf("%d", &d[cust_avail].credit_s);
printf("| |\n");
printf("|________________________________________________________________________|\n\n\n");
d[cust_avail].srno = cust_avail + 1;
if (cust_avail == 0)
{
d[cust_avail].ac = 5738321;
}
else
{
d[cust_avail].ac = d[cust_avail - 1].ac + 13;
}
// ACCOUNT CREATED A/C NUMBER ALLOTED
printf(" ___________________________________________________________________________ \n");
printf("| ***** WELCOME TO S.A.S BANK ***** |\n");
printf("| |\n");
printf("| Your account has been created. Your account number is %d |\n", d[cust_avail].ac);
printf("| Welcome to S.A.S Bank, where we treat our customers as family |\n");
printf("| Let us go through some guidelines. Every bank user needs to know |\n");
printf("| maintain a minimum account balance of Rs.5000 |\n");
printf("| |\n");
printf("|____________________________________________________________________________|\n\n\n");
// TO CHECK BALANCE IS MORE THAN RS. 5000
while (entered_bal < 5000)
{
printf("\n\n Enter amount of money you want to deposit to your bank account:");
float bal;
scanf("%f", &bal);
entered_bal += bal;
fflush(stdin);
d[cust_avail].balance += entered_bal;
printf("\n\nDo you want to print the deposit reciept\nY-->1\nN-->2:");
int reciept;
scanf("%d", &reciept);
// RECIEPT PRINT
if (reciept == 1)
{
deposit_reciept(d[cust_avail].ac, entered_bal);
}
if (entered_bal < 5000)
{
printf("Please deposit atleast %f more amount to reach minimum requirement", (5000 - entered_bal));
}
}
printf("\n\n");
printf("\n\n");
cust_avail++;
}
// Admin login
else if (choice1 == 3)
{
int try_admin = 0;
char user_try[10];
char pass_try[20];
printf(" Enter admin username:");
scanf("%s", user_try);
printf("\n Enter admin password:");
scanf("%s", pass_try);
// LOGIN CONDITION FOR ADMIN
if (strcmp(user_try, admin_user) == 0 && strcmp(pass_try, admin_pass) == 0)
{
while (infinity == 0)
{
int choice_admn;
printf(" \n_______________________________________________________________________________\n");
printf("| |\n");
printf("| |\n");
printf("| SAS BANK |\n");
printf("| |\n");
printf("| ADMIN |\n");
printf("| Welcome to SAS BANK |\n");
printf("| ----------> |\n");
printf("| |\n");
printf("| |\n");
printf("| ENTER YOUR CHOICE: |\n");
printf("| |\n");
printf("| 1. SHOW USER DATA BASE |\n");
printf("| 2. SEARCH USER |\n");
printf("| 3. MONITOR BANK'S WEALTH |\n");
printf("| |\n");
printf("| 4. LOG OUT |\n");
printf("| |\n");
printf("|_______________________________________________________________________________|\n");
scanf("%d", &choice_admn);
// SHOW USER DATA BASE
if (choice_admn == 1)
{
printf("SRNO\tACC.NO.\tNAME\tPHONE\t\tAGE\tPAN NO\tBALANCE\t\tCREDIT SCORE\tLOAN AMOUNT\tEMI\t\tBULLET PAYMENT\tFIXED DEPOSIT\n");
for (int j = 0; j < cust_avail; j++)
{
printf("%d\t%d\t%s\t%s\t%d\t%s\t%f\t%d\t\t%f\t%f\t%f\t%f\n", d[j].srno, d[j].ac, d[j].name, d[j].phone, d[j].age, d[j].pan, d[j].balance, d[j].credit_s, d[j].loan_amt, d[j].emi, d[j].bull_pay, d[j].fd);
}
}
// SEARCH USER
else if (choice_admn == 2)
{
int choice_search;
printf(" _______________________________________________________________________________\n");
printf("| |\n");
printf("| |\n");
printf("| SAS BANK |\n");
printf("| |\n");
printf("| ADMIN |\n");
printf("| Welcome to SAS BANK |\n");
printf("| ----------> |\n");
printf("| |\n");
printf("| |\n");
printf("| ENTER HOW YOU WANT TO SEARCH THE USER: |\n");
printf("| |\n");
printf("| 1. SEARCH BY ACCOUNT NUMBER |\n");
printf("| |\n");
printf("| |\n");
printf("| |\n");
printf("|_______________________________________________________________________________|\n");
scanf("%d", &choice_search);
// Search By Account Number
if (choice_search == 1)
{
int j = check_ac_search();
printf("SRNO\tACC.NO.\tNAME\tPHONE\t\tAGE\tPAN NO\tBALANCE\t\tCREDIT SCORE\tLOAN AMOUNT\tEMI\t\tBULLET PAYMENT\tFIXED DEPOSIT\n");
printf("%d\t%d\t%s\t%s\t%d\t%s\t%f\t%d\t\t%f\t%f\t%f\t%f\n", d[j].srno, d[j].ac, d[j].name, d[j].phone, d[j].age, d[j].pan, d[j].balance, d[j].credit_s, d[j].loan_amt, d[j].emi, d[j].bull_pay, d[j].fd);
}
}
// MONITOR BANK'S WEALTH
else if (choice_admn == 3)
{
float bank_wealth = 0;
float bank_deposits = 0;
float bank_fixed_deposits = 0;
float bank_loans = 0;
// TO CALCULATE TOTAL BANK WEALTH
for (int i = 0; i < cust_avail; i++)
{
bank_wealth = bank_wealth + d[i].balance + d[i].fd - d[i].loan_amt;
bank_deposits = bank_deposits + d[i].balance;
bank_fixed_deposits = bank_fixed_deposits + d[i].fd;
bank_loans = bank_loans + d[i].loan_amt;
}
printf(" _______________________________________________________________________________\n");
printf("| |\n");
printf("| |\n");
printf("| SAS BANK |\n");
printf("| |\n");
printf("| |\n");
printf("| Bank total wealth : %f \n", bank_wealth);
printf("| |\n");
printf("| Bank total deposits : %f \n", bank_deposits);
printf("| |\n");
printf("| Bank total fixed_deposits : %f \n", bank_fixed_deposits);
printf("| |\n");
printf("| Bank total loan Amount : %f \n", bank_loans);
printf("| |\n");
printf("| |\n");
printf("|_______________________________________________________________________________|\n");
}
// LOG OUT
else if (choice_admn == 4)
{
printf("Logging Out.....\n");
break;
}
}
}
}
// CLOSE APPLICATION
else if (choice1 == 4)
{
printf(" See you soon");
break;
}
else
printf(" Wrong choice choose again\n");
}
}