-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbank.java
96 lines (82 loc) · 2.26 KB
/
bank.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
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import BankManagement.bankManagement;
public class bank {
public static void main(String args[]) // main class of bank
throws IOException {
BufferedReader sc = new BufferedReader(
new InputStreamReader(System.in));
String name = "";
int pass_code;
int ac_no;
int ch;
while (true) {
System.out.println(
"\n ->|| Welcome to InBank ||<- \n");
System.out.println("1)Create Account");
System.out.println("2)Login Account");
System.out.println("9)Exit");
try {
System.out.print("\n Enter Input:"); // user input
ch = Integer.parseInt(sc.readLine());
switch (ch) {
case 1:
try {
System.out.print(
"Enter Unique UserName:");
name = sc.readLine();
System.out.print(
"Enter New Password:");
pass_code = Integer.parseInt(
sc.readLine());
if (bankManagement.createAccount(
name, pass_code)) {
System.out.println(
"MSG : Account Created Successfully!\n");
} else {
System.out.println(
"ERR : Account Creation Failed!\n");
}
} catch (Exception e) {
System.out.println(
" ERR : Enter Valid Data::Insertion Failed!\n");
}
break;
case 2:
try {
System.out.print(
"Enter UserName:");
name = sc.readLine();
System.out.print(
"Enter Password:");
pass_code = Integer.parseInt(
sc.readLine());
if (bankManagement.loginAccount(
name, pass_code)) {
System.out.println(
"MSG : Logout Successfully!\n");
} else {
System.out.println(
"ERR : login Failed!\n");
}
} catch (Exception e) {
System.out.println(
" ERR : Enter Valid Data::Login Failed!\n");
}
break;
case 9:
System.out.println(
"Exited Successfully!\n\n Thank You :)");
sc.close();
System.exit(0);
break;
default:
System.out.println("Invalid Entry!\n");
}
} catch (Exception e) {
System.out.println("Enter Valid Entry!");
}
}
}
}