-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathController.java
More file actions
54 lines (44 loc) · 1.08 KB
/
Controller.java
File metadata and controls
54 lines (44 loc) · 1.08 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
52
53
54
import java.util.Scanner;
/**
* Created by alex on 07/12/2016.
*/
public class Controller {
private UserManager userManager;
private PostManager postManager;
public Controller() {
this.userManager = UserManager.getInstance();
this.postManager = PostManager.getInstance();
}
public void pathsController() {
boolean running = true;
while (running) {
System.out.print("\n############################## \n");
System.out.println("[1] \t create User");
System.out.println("[2] \t add post");
System.out.println("[3] \t view all posts");
System.out.println("[4] \t view posts by user");
System.out.println("[9] \t to exit");
Scanner scanner = new Scanner(System.in);
Integer route = scanner.nextInt();
switch (route) {
case 1:
userManager.addUser();
break;
case 2:
postManager.addPost();
break;
case 3:
postManager.viewAllPosts();
break;
case 4:
postManager.viewPostsByUser();
break;
case 9:
running = false;
break;
default:
System.out.println("Unsupported input");
}
}
}
}