-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.java
53 lines (50 loc) · 1.69 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
49
50
51
52
53
import java.sql.SQLException;
import javax.swing.JOptionPane;
public class Main {
static void menu(){
try{
String options = "Welcome!\n\n 1) Create Band\n 2) List Bands\n 3) Update Band\n 4) Delete Band\n "
+ "5) Create Album\n 6) List Albums\n 7) Update Album\n 8) Delete Album\n 0) Exit";
String opString = JOptionPane.showInputDialog(null, options);
int op = Integer.parseInt(opString);
switch(op){
case 0 :
System.exit(0);
case 1:
CreateBand.createBand();
break;
case 2:
ListBands.listBands();
break;
case 3:
UpdateBand.updateBand();
break;
case 4:
DeleteBand.deleteBand();
break;
case 5:
CreateAlbum.createAlbum();
break;
case 6:
ListAlbums.listAlbums();
break;
case 7:
UpdateAlbum.updateAlbum();
break;
case 8:
DeleteAlbum.deleteAlbum();
break;
default:
JOptionPane.showMessageDialog(null, "Type a valid option");
menu();
}
} catch(NumberFormatException | SQLException e){
JOptionPane.showMessageDialog(null, "Type a number next time...");
menu();
}
}
public static void main(String[] args) {
Connect.connect();
menu();
}
}