-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBankMain.java
More file actions
51 lines (44 loc) · 1.38 KB
/
BankMain.java
File metadata and controls
51 lines (44 loc) · 1.38 KB
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
import java.util.Scanner;
import service.BankServices;
import ui.InputHandler;
public class BankMain {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
BankServices bank = new BankServices();
InputHandler input = new InputHandler(sc);
String cont;
do {
showMenu();
int choice = input.getInt("Choose (0-8): ", 0, 8);
try {
switch (choice) {
case 0 -> bank.showDashboard();
case 1 -> bank.addAccount(input);
case 2 -> bank.displayAllAccounts();
case 3 -> input.search(bank);
case 4 -> input.transaction(bank);
case 5 -> input.update(bank);
case 6 -> input.delete(bank);
case 7 -> bank.addInterestToAllAccounts();
case 8 -> input.statement(bank);
default -> System.out.println("Invalid choice!");
}
} catch (Exception e) {
System.out.println("❌ " + e.getMessage());
}
cont = input.getString("Continue? (yes/no): ");
} while ("yes".equalsIgnoreCase(cont));
sc.close();
System.out.println("--------------------Thank You--------------------");
}
private static void showMenu() {
System.out.println("""
---------------------Main Menu--------------------
0:Dashboard 1:Add Account
2:Display All 3:Search Account
4:Transaction 5:Update
6:Delete 7:Interest
8:Statement
-----------------------------------------------""");
}
}