-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSTARSUI.java
More file actions
61 lines (54 loc) · 1.71 KB
/
STARSUI.java
File metadata and controls
61 lines (54 loc) · 1.71 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
55
56
57
58
59
60
61
import java.util.Scanner;
import UserInterfaces.StaffUI;
import UserInterfaces.StudentUI;
/**
* The main user interface that will run the entire program
*
* @author Goh Wei Pin
* @version 1.0
* @since 2020-11-25
*/
public class STARSUI {
public static void main(String[] args) {
boolean run = true;
Scanner sc = new Scanner(System.in);
while (run) {
System.out.println("========================");
System.out.println("====Welcome to STARS====");
System.out.println("Login domain:");
System.out.println("1. Student");
System.out.println("2. Staff");
System.out.println("3. Exit");
System.out.println("========================");
int userChoice;
while (true) {
while (!sc.hasNextInt()) {
System.out.println("Integers only!");
sc.next();
}
userChoice = sc.nextInt();
if (userChoice > 3 || userChoice <= 0) {
System.out.println("Input 1-3 only");
} else {
break;
}
}
switch (userChoice) {
case 1:
StudentUI studentUI = new StudentUI();
studentUI.runUI();
break;
case 2:
StaffUI staffUI = new StaffUI();
staffUI.runUI();
break;
case 3:
System.out.println("Logging off~");
run = false;
break;
default:
break;
}
}
}
}