Answered step by step
Verified Expert Solution
Question
1 Approved Answer
4 . 1 3 LAB: Playlist ( output linked list ) Given main ( ) , complete the songNode class to include the printSongInfo (
LAB: Playlist output linked list
Given main complete the songNode class to include the printSongInfo method. Then write the Playlist class' printPlaylist method
to print all songs in the playlist. DO NOT print the dummy head node.
Ex: If the input is:
import java.util.Scanner;
public class Playlist
TODO: Write method to ouptut list of songs
public static void main String args
Scanner scnr new ScannerSystemin;
SongNode headNode;
SongNode currNode;
SongNode lastNode;
String songTitle;
int songLength;
String songArtist;
Front of nodes list
headNode new SongNode;
lastNode headNode;
Read user input until entered
songTitle scnrnextLine;
while songTitle.equals
songLength scnrnextInt;
scnrnextLine;
songArtist scnrnextLine;
currNode new SongNodesongTitle songLength, songArtist;
lastNode.insertAftercurrNode;
lastNode currNode;
songTitle scnrnextLine;
Print linked list
System.out.printlnLIST OF SONGS";
System.out.println;
printPlaylistheadNode;
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