-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDigitalcomProcess.java
47 lines (43 loc) · 1.66 KB
/
DigitalcomProcess.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
// Author: Sarthak Shrivastava
import java.util.List;
import java.util.Scanner;
public class DigitalcomProcess {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (true) {
System.out.println("====================================");
System.out.println("Main Menu");
System.out.println("1. Register New User");
System.out.println("2. View Games");
System.out.println("3. Search by Author");
System.out.println("4. Exit");
int option = sc.nextInt();
try {
if (option == 1) {
System.out.println("Enter User ID:");
String userID = sc.next();
System.out.println("Enter Password:");
String password = sc.next();
User.addUser(userID, password);
} else if (option == 2) {
List<Game> gamesList = GameService.viewAll();
for (Game g : gamesList) {
System.out.println(g);
}
} else if (option == 3) {
System.out.println("Enter Author Name:");
String author = sc.next();
String res = GameService.authorSearch(author);
System.out.println(res);
} else if (option == 4) {
System.out.println("Thanks for visiting.");
break;
}
} catch (Exception e) {
System.err.println(e.getMessage());
}
}
sc.close();
return;
}
}