-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.java
48 lines (46 loc) · 1.63 KB
/
Main.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
48
import java.util.Scanner;
public class Main {
public static void displayMenu() {
System.out.println("1. Add 5 student");
System.out.println("2. Print 5 Student");
System.out.println("3. Delete student from ID");
System.out.println("4. Find by First Name");
System.out.println("5. Display Student has the highest point");
System.out.println("6. Quit");
}
public static void main(String[] args) {
Handle handle = new Handle();
boolean programme = true;
Scanner sc = new Scanner(System.in);
while (programme) {
try {
Main.displayMenu();
int choice = Integer.parseInt(sc.nextLine());
switch (choice) {
case 1:
handle.addStudent();
break;
case 2:
handle.outStudent();
break;
case 3:
handle.destroyById();
break;
case 4:
System.out.println("Enter the firstname: ");
String firstName = sc.nextLine();
handle.findByFirstName(firstName);
break;
case 5:
handle.Max();
break;
default:
System.out.println("Wrong");
break;
}
} catch (Exception e) {
System.out.println("Error, restart menu");
}
}
}
}