forked from kishanrajput23/Java-Projects-Collections
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbank.java
99 lines (87 loc) · 2.06 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
97
98
99
package banking;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
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");
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;
default:
System.out.println("Invalid Entry!\n");
}
if (ch == 5) {
System.out.println(
"Exited Successfully!\n\n Thank You :)");
break;
}
}
catch (Exception e) {
System.out.println("Enter Valid Entry!");
}
}
sc.close();
}
}