Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C + + You will be building a linked list. Make sure to keep track of both the head and tail nodes. Step 1 :
C
You will be building a linked list. Make sure to keep track of both the head and tail nodes.
Step : Create three files to submit and build the PlaylistNode class.
PlaylistNode.h Class declaration
PlaylistNode.cpp Class definition
main.cpp main function
Build the PlaylistNode class per the following specifications. Note: Some functions can initially be function stubs empty functions to be completed in later steps.
Private data members
string uniqueID Initialized to "none" in default constructor
string songName Initialized to "none" in default constructor
string artistName Initialized to "none" in default constructor
int songLength Initialized to in default constructor
PlaylistNode nextNodePtr Initialized to in default constructor
Default constructor
Parameterized constructor
Public member functions
GetID Accessor
GetSongName Accessor
GetArtistName Accessor
GetSongLength Accessor
GetNext Accessor
InsertAfterPlaylistNode nodePtr Mutator
SetNextPlaylistNode nodePtr Mutator
PrintPlaylistNode Outputs uniqueID, songname, artistName, and songLength based on the format example below.
Ex of PrintPlaylistNode output:
Unique ID: S
Song Name: Peg
Artist Name: Steely Dan
Song Length in seconds:
Step : In main prompt the user for the title of the playlist. pt
Ex:
Enter playlist's title:
JAMZ
Step : Implement the PrintMenu function. pt
PrintMenu takes the playlist title as a parameter and outputs a menu of options to manipulate the playlist.
Ex:
JAMZ PLAYLIST MENU
a Add song
d Remove song
c Change position of song
s Output songs by specific artist
t Output total time of playlist in seconds
o Output full playlist
q Quit
Step : Implement the ExecuteMenu function. pt
ExecuteMenu takes parameters: a character representing the user's choice, a playlist title, and the pointer to the head node of a playlist. ExecuteMenu performs the menu options described below according to the user's choice and returns the pointer to the head node of the playlist.
Step : In main call PrintMenu and prompt for the user's choice of menu options.
Each option is represented by a single character. If an invalid character is entered, continue to prompt for a valid choice. When a valid option is entered, execute the option by calling ExecuteMenu Then, print the menu, and prompt for a new option. Continue until the user enters q Hint: Implement Quit before implementing other options.
Ex
JAMZ PLAYLIST MENU
a Add song
d Remove song
c Change position of song
s Output songs by specific artist
t Output total time of playlist in seconds
o Output full playlist
q Quit
Choose an option:
Step : Implement "Output full playlist" menu option in ExecuteMenu
If the list is empty, output: Playlist is empty
Ex:
JAMZ OUTPUT FULL PLAYLIST
Unique ID: SD
Song Name: Peg
Artist Name: Steely Dan
Song Length in seconds:
Unique ID: JJ
Song Name: All For You
Artist Name: Janet Jackson
Song Length in seconds:
Unique ID: J
Song Name: Canned Heat
Artist Name: Jamiroquai
Song Length in seconds:
Unique ID: JJ
Song Name: Black Eagle
Artist Name: Janet Jackson
Song Length in seconds:
Unique ID: SD
Song Name: I Got The News
Artist Name: Steely Dan
Song Length in seconds:
Step : Implement the "Add song" menu option in ExecuteMenu
New additions are added to the end of the list.
Ex:
ADD SONG
Enter song's unique ID:
SD
Enter song's name:
Peg
Enter artist's name:
Steely Dan
Enter song's length in seconds:
Step : Implement the "Remove song" menu option in ExecuteMenu
Prompt the user for the unique ID of the song to be removed.
Ex:
REMOVE SONG
Enter song's unique ID:
JJ
"All For You" removed.
Step : Implement the "Change position of song" menu option in ExecuteMenu
Prompt the user for the current position of the song and the desired new position. Valid new positions are n the number of nodes If the user enters a new position that is less than move the node to the position immediately after the head If the user enters a new position greater than n move the node to position n the tail cases will be tested:
Moving the head node
Moving the tail node
Moving a node to the head
Moving a node to the tail
Moving a node up the list
Moving a node down the list
Ex:
CHANGE POSITION OF SONG
Enter song's current position:
Enter new position for song:
"Canned Heat" moved to position
Step : Implement the "Output songs by specific artist" menu option in ExecuteMenu
Prompt the user for the artist's name, and output the node's information, starting with the node's current position.
Step : Implement the "Output total time of playlist" menu option in ExecuteMenu
Output the sum of the time of the playlist's songs in seconds
Ex:
OUTPUT TOTAL TIME OF PLAYLIST IN SECONDS
Total time: seconds
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