File tree 1 file changed +99
-0
lines changed
1 file changed +99
-0
lines changed Original file line number Diff line number Diff line change
1
+ package banking ;
2
+
3
+ import java .io .BufferedReader ;
4
+ import java .io .IOException ;
5
+ import java .io .InputStreamReader ;
6
+
7
+ public class bank {
8
+ public static void main (String args []) //main class of bank
9
+ throws IOException
10
+ {
11
+
12
+ BufferedReader sc = new BufferedReader (
13
+ new InputStreamReader (System .in ));
14
+ String name = "" ;
15
+ int pass_code ;
16
+ int ac_no ;
17
+ int ch ;
18
+
19
+ while (true ) {
20
+ System .out .println (
21
+ "\n ->|| Welcome to InBank ||<- \n " );
22
+ System .out .println ("1)Create Account" );
23
+ System .out .println ("2)Login Account" );
24
+
25
+ try {
26
+ System .out .print ("\n Enter Input:" ); //user input
27
+ ch = Integer .parseInt (sc .readLine ());
28
+
29
+ switch (ch ) {
30
+ case 1 :
31
+ try {
32
+ System .out .print (
33
+ "Enter Unique UserName:" );
34
+ name = sc .readLine ();
35
+ System .out .print (
36
+ "Enter New Password:" );
37
+ pass_code = Integer .parseInt (
38
+ sc .readLine ());
39
+
40
+ if (bankManagement .createAccount (
41
+ name , pass_code )) {
42
+ System .out .println (
43
+ "MSG : Account Created Successfully!\n " );
44
+ }
45
+ else {
46
+ System .out .println (
47
+ "ERR : Account Creation Failed!\n " );
48
+ }
49
+ }
50
+ catch (Exception e ) {
51
+ System .out .println (
52
+ " ERR : Enter Valid Data::Insertion Failed!\n " );
53
+ }
54
+ break ;
55
+
56
+ case 2 :
57
+ try {
58
+ System .out .print (
59
+ "Enter UserName:" );
60
+ name = sc .readLine ();
61
+ System .out .print (
62
+ "Enter Password:" );
63
+ pass_code = Integer .parseInt (
64
+ sc .readLine ());
65
+
66
+ if (bankManagement .loginAccount (
67
+ name , pass_code )) {
68
+ System .out .println (
69
+ "MSG : Logout Successfully!\n " );
70
+ }
71
+ else {
72
+ System .out .println (
73
+ "ERR : login Failed!\n " );
74
+ }
75
+ }
76
+ catch (Exception e ) {
77
+ System .out .println (
78
+ " ERR : Enter Valid Data::Login Failed!\n " );
79
+ }
80
+
81
+ break ;
82
+
83
+ default :
84
+ System .out .println ("Invalid Entry!\n " );
85
+ }
86
+
87
+ if (ch == 5 ) {
88
+ System .out .println (
89
+ "Exited Successfully!\n \n Thank You :)" );
90
+ break ;
91
+ }
92
+ }
93
+ catch (Exception e ) {
94
+ System .out .println ("Enter Valid Entry!" );
95
+ }
96
+ }
97
+ sc .close ();
98
+ }
99
+ }
You can’t perform that action at this time.
0 commit comments