-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.java
executable file
·47 lines (42 loc) · 1.38 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
/**
* main method
* display menus : display data, display sorted data, store data in csv file, exit, display menu
* take choice and call appropriate method.
* */
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
PioneersData pioneer = new PioneersData("ComputingPioneers.txt");
displayMenu();
int num = 0;
while (true) {
System.out.print("Enter your choice : ");
num = scanner.nextInt();
switch (num){
case 1:
pioneer.display();
break;
case 2:
pioneer.displaySort();
break;
case 3:
pioneer.storeInFile();
break;
case 4:
return;
default:
displayMenu();
}
}
}
static void displayMenu(){
System.out.println("Menu");
System.out.println("1 : Display data.");
System.out.println("2 : Display sorted data.");
System.out.println("3 : Store data in csv file.");
System.out.println("4 : exit");
System.out.println("Enter any other number to see menu.");
}
}