-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.java
87 lines (79 loc) · 2.17 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/**
* @Class : Main
* @Description : Class to drive the entire Music Player APp
* showAllSongs() -> Function to display all the songs sort by song title in display format
*/
package com.onebill.trainingAssessment.musicplayer;
import java.util.Scanner;
/**
* @author Rathesh Prabakar
* @version 2.0
*/
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("------Welcome to MX Music Player------");
System.out.println("Press 1 to Play a Song");
System.out.println("Press 2 to Search a Song");
System.out.println("Press 3 to Show all Songs");
System.out.println("Press 4 to Operate on Songs Database\nEnter your choice\t");
int choice = input.nextInt();
switch (choice) {
case 1:
Play playSongs = new Play();
System.out.println("Press A to 'Play All Songs'");
System.out.println("Press B to 'Play Songs Randomly'");
System.out.println("Press C to 'Play a Particular Song'");
System.out.println("Enter your choice\t");
String playChoice = input.next();
switch (playChoice) {
case "A":
playSongs.playAllSongs();
break;
case "B":
playSongs.playSongsRandomly();
break;
case "C":
System.out.println("Enter the song title you want to play");
String querySong = input.nextLine();
playSongs.playAParticularSong(querySong);
break;
}
playSongs=null;
break;
case 2:
Search search = new Search();
search.SearchSong();
search=null;
break;
case 3:
DisplaySongs show = new DisplaySongs();
System.out.println("\nDisplaying All Songs\n");
show.showAllSongs();
show=null;
break;
case 4:
Operation edit = new Operation();
System.out.println("Press A to Add Songs to Songs Repository");
System.out.println("Press B to Edit an existing Song");
System.out.println("Press C to Delete an existing Song");
String userChoice = input.next();
switch (userChoice) {
case "A":
edit.addSongtoDB();
break;
case "B":
edit.editSonginDB();
break;
case "C":
edit.deleteASongInDB();
break;
}
edit = null;
break;
default:
System.out.println("Invalid Choice");
}
input.close();
}
}