Question: in C + + Given main ( ) , complete the SongNode class to include the function PrintSongInfo ( ) . Then write the PrintPlaylist
in C Given main complete the SongNode class to include the function PrintSongInfo Then write the PrintPlaylist function in main.cpp to print all songs in the playlist. DO NOT print the head node, which does not contain userinput values.
Ex: If the input is:
Stomp!
The Brothers Johnson
The Dude
Quincy Jones
You Don't Own Me
Lesley Gore
the output is:
LIST OF SONGS
Title: Stomp!
Length:
Artist: The Brothers Johnson
Title: The Dude
Length:
Artist: Quincy Jones
Title: You Don't Own Me
Length:
Artist: Lesley Gore
Given main complete the SongNode class to include the function PrintSonglnfo Then write the PrintPlaylist function in main.cpp to
print all songs in the playlist. DO NOT print the head node, which does not contain userinput values.
Ex: If the input is:
Stomp!
The Brothers Johnson
The Dude
Quincy Jones
You Don't Own Me
Lesley Gore
the output is:
LIST OF SONGS
Title: Stomp!
Length:
Artist: The Brothers Johnson
Title: The Dude
Length:
Artist: Quincy Jones
Title: You Don't Own Me
Length:
Artist: Lesley Gore
GIVEN CODE
maincpp
#include
#include "SongNode.h
TODO: Write PrintPlaylist function
int main
SongNode headNode;
SongNode currNode;
SongNode lastNode;
string songTitle;
string songLength;
string songArtist;
Front of nodes list
headNode new SongNode;
lastNode headNode;
Read user input until entered
getlinecin songTitle;
while songTitle
getlinecin songLength;
getlinecin songArtist;
currNode new SongNodesongTitle songLength, songArtist;
lastNodeInsertAftercurrNode;
lastNode currNode;
getlinecin songTitle;
Print linked list
cout "LIST OF SONGS" endl;
cout endl;
PrintPlaylistheadNode;
return ;
SongNodehCode
#include "iostream"
#include
using namespace std;
class SongNode
private:
string songTitle;
string songLength;
string songArtist;
SongNode nextNodeRef; Reference to the next node
public:
SongNode
songTitle ;
songLength ;
songArtist ;
nextNodeRef nullptr;
Constructor
SongNodestring songTitleInit, string songLengthInit, string songArtistInit;
Constructor
SongNodestring songTitleInit, string songLengthInit, string songArtistInit, SongNode nextLoc;
insertAfter
void InsertAfterSongNode nodeLoc;
Get location pointed by nextNodeRef
SongNode GetNext;
Prints song information
void PrintSongInfo;
;
SongnodecppCode
#include "SongNode.h
Constructor
SongNode::SongNodestring songTitleInit, string songLengthInit, string songArtistInit
thissongTitle songTitleInit;
thissongLength songLengthInit;
thissongArtist songArtistInit;
thisnextNodeRef nullptr;
Constructor
SongNode::SongNodestring songTitleInit, string songLengthInit, string songArtistInit, SongNode nextLoc
thissongTitle songTitleInit;
thissongLength songLengthInit;
thissongArtist songArtistInit;
thisnextNodeRef nextLoc;
insertAfter
void SongNode::InsertAfterSongNode nodeLoc
SongNode tmpNext;
tmpNext thisnextNodeRef;
thisnextNodeRef nodeLoc;
nodeLocnextNodeRef tmpNext;
Get location pointed by nextNodeRef
SongNode SongNode::GetNext
return thisnextNodeRef;
TODO: Write PrintSongInfo function
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
