-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUserInteraction.java
More file actions
33 lines (30 loc) · 1.06 KB
/
UserInteraction.java
File metadata and controls
33 lines (30 loc) · 1.06 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
import java.util.InputMismatchException;
import java.util.Scanner;
import java.io.FileNotFoundException;
public class UserInteraction {
static Server svr;
public static void main(String[] args) throws FileNotFoundException {
svr = new Server();
Node n = svr.getNode(1);
Scanner UserInput = new Scanner(System.in);
console:
while (true) {
System.out.println(n.getQuestion());
System.out.println(n.getDescription());
String NextNodeID = UserInput.nextLine();
switch (NextNodeID) {
case "1":
n = svr.getNode(n.getYesID());
break;
case "2":
n = svr.getNode(n.getNoID());
break;
case "3":
break console;
default:
System.out.println("INPUT ERROR: Please ensure you are only using [1] OR [2] to enter your input. USE [3] if you wish to exit.\n");
break;
}
}
}
}