Answered step by step
Verified Expert Solution
Question
1 Approved Answer
import java.util.Scanner; import java.util.ArrayList; import java.util.Collections; public class Playlist { public static void printMenu ( String playlistTitle ) { System.out.println ( playlistTitle + PLAYLIST MENU
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;
public class Playlist
public static void printMenuString playlistTitle
System.out.printlnplaylistTitle "PLAYLIST MENU";
System.out.printlna Add song";
System.out.printlnd Remove Song";
System.out.printlnc Change position of song";
System.out.printlns Output songs by specific artist";
System.out.printlnt Output total time of playlist";
System.out.printlno Output full playlist";
System.out.printlnq Quit";
public static SongEntry executeMenuchar option, String playlistTitle, SongEntry headNode, Scanner scnr
SongEntry tailNode headNode;
iftailNodenull
whiletailNodegetNextnull
tailNode tailNode.getNext;
ifoption a
Perform "Add song"
scnrnextLine;
System.out.printlnADD SONG";
System.out.printlnEnter song's unique ID:;
String uniqueID scnrnextLine;
System.out.printlnEnter song's name:";
String songName scnrnextLine;
System.out.printlnEnter artist's name:";
String artistName scnrnextLine;
System.out.printlnEnter song's length in seconds:;
int songLength scnrnextLine;
SongEntry newSong new SongEntryuniqueID songName, artistName, songLength;
ifheadNode null
headNode newSong;
else
tailNode.insertAfternewSong;
tailNode tailNode.getNext;
else ifoption d
Perform "Remove song"
else ifoption c
Perform Change position of song"
else ifoption s
Output songs by specific artist
else ifoption t
"Output total time of playlist"
else ifoption o
o Output full playlist"
System.out.printlnplaylistTitle OUTPUT FULL PLAYLIST";
ifheadNode null
System.out.printlnPlaylist is empty";
System.out.println;
else
int numNodes ;
SongEntry currPrintNode headNode;
whilecurrPrintNodenull
System.out.printlnnumNode ;
currPrintNode.printPlaylistSongs;
currPrintNode currPrintNode.getNext;
numNodes;
System.out.println;
return headNode;
public static void mainString args
Scanner scnr new ScannerSystemin;
System.out.printlnEnter playlist's title:";
String playlistTitle scnrnextLine;
System.out.println;
printMenuplaylistTitle;
System.out.printlnChoose an option:";
char menuOption scnrnextLinecharAt;
SongEntry headNode null;
whilemenuOptionq
ifmenuOption adcsto
headNode executeMenumenuOption playlistTitle, headNode, scnr;
else
System.out.printlnWrong menu selection";
System.out.printlnChoose an option:";
menuOption scnrnextLinecharAt;
IM GETTING AN ERROR THAT STATES "public static void mainString args IS AN ILLEGAL START OF EXPRESSION. I WOULD LOVE IF SOMEONE COULD HELP ME FIX THAT. THANK YOU
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started