-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbank_project_shown.java
643 lines (591 loc) · 20.7 KB
/
bank_project_shown.java
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
import java.io.*;
import java.util.*;
class bank2
{
int accountNumber[]=new int[10000];
String AccountHolderName[]=new String[10000];
char AccountType1[]=new char[10000];
String AccountType[]=new String[10000];
long accountBalance[]=new long[10000];
String password[]=new String[10000];
String date[]=new String[10000];
long pan_card[]=new long[10000];
String dob[]=new String[10000];
String c[]=new String[10000];
String notification[]=new String[10000];
long a;
int b=10;
String s,s1="";
public void exist()
{
accountNumber[0]=78600;
accountNumber[1]=22134;
accountNumber[2]=12121;
accountNumber[3]=34243;
accountNumber[4]=12764;
accountNumber[5]=22313;
accountNumber[6]=46274;
accountNumber[7]=12224;
accountNumber[8]=98822;
accountNumber[9]=12776;
AccountHolderName[0]="MOHAMMED SADIQUE";
AccountHolderName[1]="MOHAMMAD ANAS";
AccountHolderName[2]="RAHUL SINGH";
AccountHolderName[3]="VIJEY CHAUHAN";
AccountHolderName[4]="ARRTI SHARMA";
AccountHolderName[5]="Chintu Tyagi";
AccountHolderName[6]="Tapasya Singh";
AccountHolderName[7]="Siddharth Shukla";
AccountHolderName[8]="Baseer Ali";
AccountHolderName[9]="Priyank Sharma";
AccountType1[0]='s';
AccountType1[1]='s';
AccountType1[2]='s';
AccountType1[3]='s';
AccountType1[4]='c';
AccountType1[5]='c';
AccountType1[6]='c';
AccountType1[7]='c';
AccountType1[8]='c';
AccountType1[9]='c';
AccountType[0]="Savings Account";
AccountType[1]="Savings Account";
AccountType[2]="Savings Account";
AccountType[3]="Savings Account";
AccountType[4]="Current Account";
AccountType[5]="Current Account";
AccountType[6]="Current Account";
AccountType[7]="Current Account";
AccountType[8]="Current Account";
AccountType[9]="Current Account";
accountBalance[0]=99991093;
accountBalance[1]=342222;
accountBalance[2]=25462;
accountBalance[3]=23400;
accountBalance[4]=47600;
accountBalance[5]=987555;
accountBalance[6]=444563574;
accountBalance[7]=42300000;
accountBalance[8]=421444;
accountBalance[9]=5467000;
password[0]="sadique375";
password[1]="123987";
password[2]="qwerty978";
password[3]="1989";
password[4]="2175";
password[5]="1q2w3e4r5t";
password[6]="1234567890";
password[7]="234234";
password[8]="qazwsx";
password[9]="789456";
date[0]="Wed Sep 11 11:12:55 GMT 2019";
date[1]="Tue Nov 05 14:18:52 GMT 2018";
date[2]="Thr Nov 06 13:23:42 GMT 2017";
date[3]="Mon Jan 14 12:18:52 GMT 2016";
date[4]="Wed Mar 20 09:43:22 GMT 2015";
date[5]="Wed Mar 27 09:43:22 GMT 2015";
date[6]="Wed Mar 13 09:43:22 GMT 2015";
date[7]="Wed Mar 6 19:43:22 GMT 2014";
date[8]="Tue Mar 5 03:43:22 GMT 2013";
date[9]="Wed Mar 20 10:43:22 GMT 2012";
pan_card[0]=21434;
pan_card[1]=98675;
pan_card[2]=23674;
pan_card[3]=19007;
pan_card[4]=67532;
pan_card[5]=73932;
pan_card[6]=78532;
pan_card[7]=77122;
pan_card[8]=22324;
pan_card[9]=21345;
dob[0]="20 January 2004";
dob[1]="29 September 2004";
dob[2]="12 December 1976";
dob[3]="03 March 1987";
dob[4]="30 June 2000";
dob[5]="20 May 1999";
dob[6]="21 May 2003";
dob[7]="22 June 1990";
dob[8]="31 January 1970";
dob[9]="31 December 1965";
for(int i=0;i<10000;i++)
notification[i]="";
}
public void createAccount()throws Exception
{
Date q=new Date();
date[b]=String.valueOf(q);
DataInputStream in=new DataInputStream(System.in);
System.out.println("----------------Welcome to Account Creation Portal-------------------");
System.out.print("\tEnter Your Name : ");
AccountHolderName[b]=in.readLine();
System.out.print("\tEnter Yours Date Of Birth : ");
dob[b]=in.readLine();
System.out.print("\tEnter Yours Pan Card Number : ");
pan_card[b]=Long.parseLong(in.readLine());
System.out.print("\tEnter New Password : ");
password[b]=in.readLine();
System.out.print("\tEnter Your Account Type\n\t'S'forSavings\n\t'C'Current : ");
AccountType1[b]=(char)in.read();
switch (AccountType1[b])
{
case 'S':
case 's':
AccountType[b]="Savings Account";
break;
case 'c':
case 'C':
AccountType[b]="Current Account";
break;
default:
System.out.println("\tYOUR ACCOUNT IS TAKEN AS SAVINGS AS YOU HAVE ENTERED WRONG TYPE");
AccountType[b]="Savings Account";
Thread.sleep(1500);
break;
}
System.out.print("\tEnter your starting balance : ");
try
{
DataInputStream o=new DataInputStream(System.in);
accountBalance[b]=Long.parseLong(o.readLine());
while(accountBalance[b]<500)
{
System.out.println("\tOops!!! Your Account balance should be minimum 500 or more.\n");
System.out.print("\tEnter your starting amount : ");
accountBalance[b]=Long.parseLong(o.readLine());
}
}
catch(Exception e)
{
DataInputStream s=new DataInputStream(System.in);
accountBalance[b]=Long.parseLong(s.readLine());
while(accountBalance[b]<500)
{
System.out.println("\tOops!!! Your Account balance should be minimum 500 or more.\n");
System.out.print("\tEnter your starting amount : ");
accountBalance[b]=Long.parseLong(s.readLine());
}
}
accountNumber[b]=(int)(Math.random()*10000);
notification[b]="";
System.out.println("\t\tAccount Created Successfully.");
System.out.println("\t\tYour Account Number is: "+accountNumber[b]);
System.out.println("\t\tPlease Note it Down.");
System.out.println("------------------------------------------------------------");
b++;
Thread.sleep(1500);
}
public void allDisplayAccount() throws Exception
{
int i;
for(i=0;i<b;i++)
{
try
{
System.out.println("\t\tDisplaying Account Information for Account Number : "+accountNumber[i]);
System.out.println("\t\t---------------------------------------------------------");
System.out.println("\t\tAccount Number : "+accountNumber[i]);
System.out.println("\t\tAccount Name : "+AccountHolderName[i]);
System.out.println("\t\tAccount Type : "+AccountType[i]);
System.out.println("\t\tAccount balance : "+accountBalance[i]);
System.out.println("\t\tPan Card Number : "+pan_card[i]);
System.out.println("\t\tDate of birth of Account Holder : "+dob[i]);
if(notification[i].compareTo(s1)==0)
System.out.println("\t\tLatest Notification : No new notification");
else
System.out.println("\t\tLatest Notification : "+notification[i]+" on "+c[i]);
System.out.println("\t\t---------------------------------------------------------\n\n");
Thread.sleep(1350);
}
catch(Exception e)
{
if(notification[i].compareTo(s1)==0)
System.out.println("\t\tLatest Notification : No new notification");
else
System.out.println("\t\tLatest Notification : "+notification[i]+" on "+c[i]);
System.out.println("\t\t---------------------------------------------------------\n\n");
Thread.sleep(1000);
}
}
System.out.println("\t\tTotal Accounts in Bank :"+b+"\n\n");
Thread.sleep(1500);
}
public void DisplayAccount(int p) throws Exception
{
System.out.println("\t\tDisplaying Account Information for Account Number : "+accountNumber[p]);
System.out.println("\t\t---------------------------------------------------------");
System.out.println("\t\tAccount Number : "+accountNumber[p]);
System.out.println("\t\tAccount Name : "+AccountHolderName[p]);
System.out.println("\t\tAccount Type : "+AccountType[p]);
System.out.println("\t\tAccount balance : "+accountBalance[p]);
System.out.println("\t\tYour Date of Birth : "+dob[p]);
System.out.println("\t\tYOUR Pan Card Number : "+pan_card[p]);
System.out.println("\t\tYour Password : _Hidden_");
try
{
if(notification[p].compareTo(s1)==0)
System.out.println("\t\tLatest Notification : No new notification");
else
System.out.println("\t\tLatest Notification : "+notification[p]+" on "+c[p]);
}
catch(Exception e)
{
if(notification[p].compareTo(s1)==0)
System.out.println("\t\tLatest Notification : No new notification");
else
System.out.println("\t\tLatest Notification : "+notification[p]+" on "+c[p]);
}
System.out.println("\t\tAccount was created on : "+date[p]);
System.out.println("\t\t---------------------------------------------------------");
Thread.sleep(1500);
}
public void DepositAmount(int p) throws Exception
{
String z="";
Date q=new Date();
DataInputStream in=new DataInputStream(System.in);
long depositAmt,pan;
System.out.println("\t\t---------------------Welcome to Deposit Portal-------------\n\n");
System.out.println("You are Depositing amount for Account Number: "+accountNumber[p]);
System.out.println("\nEnter the Amount to Deposit : ");
depositAmt=Long.parseLong(in.readLine());
z=Long.toString(depositAmt);
if(depositAmt<50000)
{
c[p]=String.valueOf(q);
accountBalance[p]+=depositAmt;
notification[p]="Amount of Rs."+z+" was deposited";
System.out.println("Amount Deposited Successfully.. \nUpdated Balance: "+accountBalance[p]);
System.out.println("\t\t-----------------------------------------------------------\n\n");
}
else
{
System.out.println("Enter your's Pan Card Number");
pan=Long.parseLong(in.readLine());
if(pan==this.pan_card[p])
{
c[p]=String.valueOf(q);
accountBalance[p]+=depositAmt;
notification[p]="Amount of Rs."+z+" was deposited";
System.out.println("Amount Deposited Successfully.. \nUpdated Balance: "+accountBalance[p]);
System.out.println("\t\t-----------------------------------------------------------\n\n");
}
else
System.out.println("Your pan card number is wrong");
}
Thread.sleep(1500);
}
public void WithdrawAmount(int p) throws Exception
{
String z="";
Date q=new Date();
DataInputStream in=new DataInputStream(System.in);
long withdrawAmt;
System.out.println("\t\t---------------Welcome to Withdrawing Portal----------------\n\n");
System.out.println("You are Withdrawing amount for Account Number: "+accountNumber[p]);
System.out.println("\nEnter the Amount to Withdraw : ");
withdrawAmt=Long.parseLong(in.readLine());
z=Long.toString(withdrawAmt);
if(withdrawAmt<=accountBalance[p])
{
accountBalance[p]-=withdrawAmt;
c[p]=String.valueOf(q);
notification[p]="Amount of Rs."+z+" was deposited";
System.out.println("Amount Withdrawn Successfully..\nUpdated Balance: "+accountBalance[p]);
System.out.println("\t\t-----------------------------------------------------------\n\n");
}
else
System.out.println("Amount Withdrawn Unsuccessfully.. Balance: "+accountBalance[p]);
Thread.sleep(1500);
}
public void transferAmt(int p)throws Exception
{
long transfer_amt=0;
int ac,i,w=0;
String a1="";
Date q=new Date();
DataInputStream in=new DataInputStream(System.in);
System.out.println("\t\t---------------Welcome to Transfer Portal----------------\n\n");
System.out.println("Enter the account no to which money is to be transfered");
ac=Integer.parseInt(in.readLine());
for(i=0;i<b;i++)
{
if(ac==accountNumber[i])
{
w=1;
System.out.println("\nEnter the Amount to transfer: ");
transfer_amt=Long.parseLong(in.readLine());
if(accountBalance[p]>=transfer_amt)
{
a1=Long.toString(transfer_amt);
accountBalance[p]-=transfer_amt;
c[p]=String.valueOf(q);
notification[p]="Amount of Rs."+a1+" was transferred to "+AccountHolderName[i];
System.out.println("Amount tarnsfer Successfully.. \nUpdated Balance: "+accountBalance[p]);
c[i]=c[p];
notification[i]="Amount of Rs."+a1+" was transferred to your account by "+AccountHolderName[p];
accountBalance[i]+=transfer_amt;
}
else
System.out.println("Your account has less money than the amount to be transferred");
System.out.println("\t\t---------------------------------------------------------\n\n");
break;
}
}
if(w==0)
{
System.out.println("No Acount exist by account number : "+ac);
System.out.println("\t\t---------------------------------------------------------\n\n");
}
}
public void login() throws Exception
{
String z="";
int ch;
int ctr=0;
int accNum;
String passWd;
Date q=new Date();
System.out.println("\t--------------WELCOME TO LOG IN PORTAL------------------------\n\n");
DataInputStream in=new DataInputStream(System.in);
System.out.println("Enter Account Number : ");
accNum=Integer.parseInt(in.readLine());
System.out.println("Enter Your Password : ");
passWd=in.readLine();
for(int i=0;i<b;i++)
{
if(accNum==this.accountNumber[i] && passWd.equals(this.password[i]))
{
ctr++;
a=accNum;
s=passWd;
System.out.println("\n\nLogged In Successfully with account number: "+this.accountNumber[i]);
System.out.println("-------------------------------------\n");
while(true)
{
System.out.println("Choose Option Number From Below Menu");
System.out.println("1.Deposit Amount");
System.out.println("2.Withdraw Amount");
System.out.println("3.Transfer Amount");
System.out.println("4.Display Account Info");
System.out.println("5.delete Account");
System.out.println("6.Loan");
System.out.println("7.Log Out");
System.out.println("8.Exit");
System.out.print("Enter your choice code 1-8 : ");
ch=Integer.parseInt(in.readLine());
switch(ch)
{
case 1:
DepositAmount(i);
break;
case 2:
WithdrawAmount(i);
break;
case 3:
transferAmt(i);
break;
case 4:
DisplayAccount(i);
break;
case 5:
delete(i);
System.out.println("Your account is deleted.");
System.out.print("You would take your remaining balance within 15 days from bank ");
System.out.println("otherwise the remaining amount will be given to bank");
break;
case 6:
loan(i);
break;
case 7:
break;
case 8:
break;
}
if(ch==5||ch==7)
{
System.out.println("\t--------------------------------------------------------------\n\n");
Thread.sleep(1500);
break;
}
if(ch==8)
{
System.out.println("\t\tThanks for using our services");
System.out.println("\t\t-----------------------------\n");
System.out.println("\t--------------------------------------------------------------\n\n");
System.exit(0);
}
}
break;
}
}
if(ctr==0)
{
System.out.println("You have Entered Incorrect Account Number or Password.Please Check Again.\nOr Your account does not exist");
System.out.println("\t--------------------------------------------------------------\n\n");
Thread.sleep(1500);
System.exit(0);
}
}
public void loan(int p)throws Exception
{
String z="";
Date q=new Date();
int ch,tu,size;
String d;
DataInputStream in=new DataInputStream(System.in);
System.out.println("\t\t------------------Welcome to The loan portal------------------\n\n");
System.out.println("Enter the type of loan for you want to apply ");
System.out.println("1-business loan");
System.out.println("2-housing loan");
System.out.println("3-Persnol loan");
System.out.println("4-Automobile loan");
ch=Integer.parseInt(in.readLine());
if(ch==1)
{
System.out.println("Requirement For business loan");
System.out.println("ITR for last year");
System.out.println("Registration Form of Company");
System.out.println("-----------------------------------");
System.out.println("Submit the above Detail To the Bank");
System.out.println("If detail are Submitted then enter : \"yes\"");
d=in.readLine();
if(d.equalsIgnoreCase("yes"))
{
System.out.println("Enter the annual turnover of the company");
tu=Integer.parseInt(in.readLine());
if(tu>=4000000)
{
System.out.println("your loan Application is approved..\nyou may come to the bank for further process");
c[p]=String.valueOf(q);
notification[p]="Your Request for loan is grantted";
}
else
System.out.println("your application is decline");
}
else
System.out.println("your application is decline");
}
if(ch==2)
{
System.out.println("Requirement For housing loan");
System.out.println("The papers of the house");
System.out.println("the map of the house to be build");
System.out.println("-----------------------------------");
System.out.println("Submit the above Detail To the Bank");
System.out.println("If detail are Submitted then enter : \"yes\"");
d=in.readLine();
if(d.equalsIgnoreCase("yes"))
{
System.out.println("your loan Application is approved..\nyou may come to the bank for further process");
c[p]=String.valueOf(q);
notification[p]="Your Request for loan is grantted";
}
else
System.out.println("your application is decline");
}
if(ch==3)
{
System.out.println("Requirement For persnol loan");
System.out.println("ITR for last year");
System.out.println("Paper's of the land to be sumbited");
System.out.println("-----------------------------------");
System.out.println("Enter the Size of the land");
size=Integer.parseInt(in.readLine());
if(size>10000)
{
System.out.println("If detail are Submitted then enter : \"yes\"");
d=in.readLine();
if(d.equalsIgnoreCase("yes"))
{
System.out.println("your loan Application is approved..\nyou may come to the bank for further process");
c[p]=String.valueOf(q);
notification[p]="Your Request for loan is grantted";
}
else
System.out.println("your application is decline");
}
else
System.out.println("your application is decline");
}
if(ch==4)
{
System.out.println("Requirement For autoobile loan");
System.out.println("The RC of the Car");
System.out.println("Sumbit the estimate of the car");
System.out.println("Submit the above Detail To the Bank");
System.out.println("-----------------------------------");
System.out.println("If detail are Submitted then enter : \"yes\"");
d=in.readLine();
if(d.equalsIgnoreCase("yes"))
{
System.out.println("your loan Application is approved..\nyou may come to the bank for further process");
c[p]=String.valueOf(q);
notification[p]="Your Request for loan is grantted";
}
else
System.out.println("your application is decline");
}
if(ch>=5)
System.out.println("wrong choice");
System.out.println("\t\t--------------------------------------------------------------\n\n");
}
public void delete(int p)
{
int size=b;
for(int j=p;j<size-1;j++)
{
accountNumber[j]=accountNumber[j+1];
AccountHolderName[j]=AccountHolderName[j+1];
AccountType1[j]=AccountType1[j+1];
AccountType[j]=AccountType[j+1];
accountBalance[j]=accountBalance[j+1];
password[j]=password[j+1];
date[j]=date[j+1];
pan_card[j]=pan_card[j+1];
dob[j]=dob[j+1];
notification[j]=notification[j+1];
c[j]=c[j+1];
}
b--;
}
bank2()throws Exception
{
DataInputStream in=new DataInputStream(System.in);
int ch;
exist();
System.out.println("\t\t\tWelcome to ST. MARY'S BANK");
System.out.println("\t\t\t--------------------------\n\n");
while(true)
{
System.out.println("\t\tSelect any Choice Number From below menu...");
System.out.println("\t\t1. Create Account\n\t\t2. Display all Account \n\t\t3. Login\n\t\t4. Exit Portal");
System.out.print("\t\tEnter Your Choice Code 1-4 : ");
ch=Integer.parseInt(in.readLine());
System.out.println();
System.out.println();
System.out.println();
switch(ch)
{
case 1:
createAccount();
break;
case 2:
allDisplayAccount();
break;
case 3:
login();
break;
case 4:
System.out.println("\t\t\tThanks for using our services");
System.out.println("\t\t\t-----------------------------");
System.exit(0);
break;
}
}
}
public static void main(String[] args)throws Exception
{
bank2 obj = new bank2();
}
}