-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
40 lines (35 loc) · 1.38 KB
/
Main.java
File metadata and controls
40 lines (35 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
import java.util.Scanner;
public class Main {
private static final Scanner scanner = new Scanner(System.in);
private static final LoginService loginService = new LoginService();
private static final RegisterService registerService = new RegisterService();
public static void main(String[] args) {
while (true) {
System.out.println("\n=== Welcome to the Event Booking System ===");
System.out.println("1. Login");
System.out.println("2. Register");
System.out.println("3. Exit");
System.out.print("Choose an option: ");
int choice = scanner.nextInt();
scanner.nextLine();
switch (choice) {
case 1 -> handleLogin();
case 2 -> registerService.register();
case 3 -> {
System.out.println("Exiting system. Goodbye!");
return;
}
default -> System.out.println("Invalid option!");
}
}
}
private static void handleLogin() {
User user = loginService.login();
if (user == null) return;
if (user.getUsername().equalsIgnoreCase("admin")) {
new AdminDashboard().showDashboard();
} else {
new UserDashboard(user.getId()).showDashboard();
}
}
}