-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
75 lines (63 loc) · 2.19 KB
/
Copy pathMain.java
File metadata and controls
75 lines (63 loc) · 2.19 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
public class Main{
// public List<Song> Songs;
public static void main(String[] args){
Main main = new Main();
main.menu();
}
public void menu(){
handler songHandler = new handler();
boolean Continue = true;
do {
System.out.println("""
Main Menu
1. Add song
2. Remove song
3. View all songs
4. View songs with chosen number of plays
5. Sort by song title
6. Sort by artist name
7. Sort by number of plays
8. Exit
""");
String choice = System.console().readLine("Enter number of option: ");
switch (choice) {
case "1":
//add song
songHandler.addSong();
break;
case "2":
//delete song
songHandler.deleteSong();
break;
case "3":
//view all
songHandler.viewSongs(songHandler.songs);
break;
case "4":
//filter view by plays
songHandler.viewByPlays();
break;
case "5":
//sort by song title
songHandler.viewSongs(songHandler.sortByTitle());
break;
case "6":
//sort by song artist
songHandler.viewSongs(songHandler.sortByArtist());
break;
case "7":
//sort by number of plays
songHandler.viewSongs(songHandler.sortByPlays());
break;
case "8":
//Exit
Continue = false;
break;
default:
//handles any exceptions
System.out.println("Not valid. Please enter a choice (1 to 8)");
break;
}
} while (Continue);
}
}