(Solved) : 88 Program Playlist Java Building Linked List Make Sure Keep Track Head Tail Nodes 1 Creat Q35533058 . . .

8.8 Program: Playlist (Java)

You will bebuilding a linked list. Make sure to keep track of both the headand tail nodes.

LAB ACTIVITY 8.8.1: Program: Playlist (Java) 0/25 Submission Instructions Additional files provided by your instructor. Playl

(1) Create two filesto submit.

  • SongEntry.java – Class declaration
  • Playlist.java – Contains main() method

Build the SongEntryclass per the following specifications. Note: Some methods caninitially be method stubs (empty methods), to be completed in latersteps.

  • Private fields
  • String uniqueID – Initialized to “none” in defaultconstructor
  • string songName – Initialized to “none” in defaultconstructor
  • string artistName – Initialized to “none” in defaultconstructor
  • int songLength – Initialized to 0 in default constructor
  • SongEntry nextNode – Initialized to null in defaultconstructor
  • Default constructor (1 pt)
  • Parameterized constructor (1 pt) – takes uniqueId, songName,artistName, and songLength
  • Public member methods
  • void insertAfter(SongEntry newNode) (1 pt)
  • void setNext(SongEntry nextNode) – Mutator (1 pt)
  • String getID()- Accessor
  • String getSongName() – Accessor
  • String getArtistName() – Accessor
  • int getSongLength() – Accessor
  • SongEntry getNext() – Accessor
  • void printPlaylistSongs()

Ex. ofprintPlaylistSongs output:

Unique ID: S123Song Name: PegArtist Name: Steely DanSong Length (in seconds): 237

(2) In main(), promptthe user for the title of the playlist. (1 pt)

Ex:

Enter playlist’s title:JAMZ

(3) Implement the printMenu() method. printMenu() takes theplaylist title as a parameter and a Scanner object, outputs a menuof options to manipulate the playlist, and reads the user menuselection. Each option is represented by a single character. Buildand output the menu within the method.

If an invalidcharacter is entered, continue to prompt for a valid choice. Hint:Implement Quit before implementing other options. Call printMenu()in the main() method. Continue to execute the menu until the userenters q to Quit. (3 pts)

Ex:

JAMZ PLAYLIST MENUa – Add songd – Remove songc – Change position of songs – Output songs by specific artistt – Output total time of playlist (in seconds)o – Output full playlistq – QuitChoose an option:

(4) Implement “Output full playlist” menu option. If the list isempty, output: Playlist is empty (3 pts)

Ex:

JAMZ – OUTPUT FULL PLAYLIST1.Unique ID: SD123Song Name: PegArtist Name: Steely DanSong Length (in seconds): 2372.Unique ID: JJ234Song Name: All For YouArtist Name: Janet JacksonSong Length (in seconds): 3913.Unique ID: J345Song Name: Canned HeatArtist Name: JamiroquaiSong Length (in seconds): 3304.Unique ID: JJ456Song Name: Black EagleArtist Name: Janet JacksonSong Length (in seconds): 1975. Unique ID: SD567Song Name: I Got The NewsArtist Name: Steely DanSong Length (in seconds): 306

Ex (empty playlist):

JAMZ – OUTPUT FULL PLAYLISTPlaylist is empty

(5) Implement the “Add song” menu item. New additions are added tothe end of the list. (2 pts)

Ex:

ADD SONGEnter song’s unique ID:SD123Enter song’s name:PegEnter artist’s name:Steely DanEnter song’s length (in seconds):237

(6) Implement the “Remove song” method. Prompt the user for theunique ID of the song to be removed.(4 pts)

Ex:

REMOVE SONGEnter song’s unique ID:JJ234″All For You” removed

(7) Implement the “Change position of song” menu option. Prompt theuser for the current position of the song and the desired newposition. Valid new positions are 1 – n (the number ofnodes). If the user enters a new position that is less than 1, movethe node to the position 1 (the head). If the user enters a newposition greater than n, move the node to positionn (the tail). 6 cases will be tested:

  • Moving the head node (1 pt)
  • Moving the tail node (1 pt)
  • Moving a node to the head (1 pt)
  • Moving a node to the tail (1 pt)
  • Moving a node up the list (1 pt)
  • Moving a node down the list (1 pt)

Ex:

CHANGE POSITION OF SONGEnter song’s current position:3Enter new position for song:2″Canned Heat” moved to position 2

(8) Implement the “Output songs by specific artist” menu option.Prompt the user for the artist’s name, and output the node’sinformation, starting with the node’s current position. (2pt)

Ex:

OUTPUT SONGS BY SPECIFIC ARTISTEnter artist’s name:Janet Jackson2.Unique ID: JJ234Song Name: All For YouArtist Name: Janet JacksonSong Length (in seconds): 3914.Unique ID: JJ456Song Name: Black EagleArtist Name: Janet JacksonSong Length (in seconds): 197

(9) Implement the “Output total time of playlist” menu option.Output the sum of the time of the playlist’s songs (in seconds). (2pts)

Ex:

OUTPUT TOTAL TIME OF PLAYLIST (IN SECONDS)Total time: 1461 secondsLAB ACTIVITY 8.8.1: Program: Playlist (Java) 0/25 Submission Instructions Additional files provided by your instructor. Playlist.java and SongEntry.java Download Compile command javac Playlist.java SongEntry.java -Werror We will use this command to compile your code Upload your files below by dragging and dropping into the area or choosing a file on your hard drive. Drag file here or Choose on hard drive Drag file here or Choose on hard drive. Playlist.java SongEntry.java Show transcribed image text LAB ACTIVITY 8.8.1: Program: Playlist (Java) 0/25 Submission Instructions Additional files provided by your instructor. Playlist.java and SongEntry.java Download Compile command javac Playlist.java SongEntry.java -Werror We will use this command to compile your code Upload your files below by dragging and dropping into the area or choosing a file on your hard drive. Drag file here or Choose on hard drive Drag file here or Choose on hard drive. Playlist.java SongEntry.java

Expert Answer


. . .