Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Step 1 : Create three files to submit. PlaylistNode.h - Struct definition and related function declarations PlaylistNode.c - Related function definitions main.c - main (

Step 1: Create three files to submit.
PlaylistNode.h - Struct definition and related function declarations
PlaylistNode.c - Related function definitions
main.c - 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
char uniqueID[50]
char songName[50]
char artistName[50]
int songLength
PlaylistNode* nextNodePtr
Related functions
CreatePlaylistNode()- Creates a new PlaylistNode. Parameters are as listed: (1 pt)
PlaylistNode* thisNode
char idInit[]
char songNameInit[]
char artistNameInit[]
int songLengthInit
PlaylistNode* nextLoc
InsertPlaylistNodeAfter(PlaylistNode* thisNode, PlaylistNode* newNode)
Inserts newNode after thisNode. (1 pt)
SetNextPlaylistNode(PlaylistNode* thisNode, PlaylistNode* newNode)
Sets the node after thisNode to newNode. (1 pt)
GetNextPlaylistNode(PlaylistNode* thisNode)
Returns location pointed by thisNode's nextNodePtr.
PrintPlaylistNode(PlaylistNode* thisNode)
Outputs uniqueID, songName, artistName, and songLength of thisNode based on the format example below.
Ex. of PrintPlaylistNode output:
Unique ID: S123
Song Name: Peg
Artist Name: Steely Dan
Song Length (in seconds): 237
Step 2: In main(), prompt the user for the title of the playlist. (1 pt)
Ex:
Enter playlist's title:
JAMZ
Step 3: Implement the PrintMenu() function. (1 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
r - 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 4: Implement the ExecuteMenu() function. (1 pt)
ExecuteMenu() takes 3 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.
Step 5: In main(), call PrintMenu() and prompt for the user's choice of menu options. (1 pt)
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
r - 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 6: Implement "Output full playlist" menu option in ExecuteMenu().(3 pts)
If the list is empty, output: Playlist is empty
Ex:
JAMZ - OUTPUT FULL PLAYLIST
1.
Unique ID: SD123
Song Name: Peg
Artist Name: Steely Dan
Song Length (in seconds): 237
2.
Unique ID: JJ234
Song Name: All For You
Artist Name: Janet Jackson
Song Length (in seconds): 391
3.
Unique ID: J345
Song Name: Canned Heat
Artist Name: Jamiroquai
Song Length (in seconds): 330
4.
Unique ID: JJ456
Song Name: Black Eagle
Artist Name: Janet Jackson
Song Length (in seconds): 197
5.
Unique ID: SD567
Song Name: I Got The News
Artist Name: Steely Dan
Song Length (in seconds): 306
Step 7: Implement the "Add song" menu option in ExecuteMenu().(2 pts)
New additions are added to the end of the list.
Ex:
ADD SONG
Enter song's unique ID:
SD123
Enter song's name:
Peg
Enter artist's name:
Steely Dan
Enter song's length (in seconds):
237
Step 8: Implement the "Remove song" menu option in ExecuteMenu().(4 pts)
Prompt the user for the unique ID of the song to be removed.
Ex:
REMOVE SONG
Enter song's unique ID:
JJ234
"All For You" removed.
Step 9: 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 1- n (the number of nodes). If the user enters a new position that is less than 1, move the node to the position 1(immediately after the head). If the user enters a new position greater than n, move the node to position n (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 SONG
Enter song's current position:
3
Enter new position for song:
2
"Canned Heat" moved to position 2
Step 10: Implement the "Output songs by specific artist" menu option in ExecuteMenu().(2 pt)
Prompt the user for the artist's name, and output the node's information, starting with the node's current position.
Ex:
OUTPUT SONGS BY SPECIFIC ARTIST
Enter artist's name:
Janet Jackson
2.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Rules In Database Systems Third International Workshop Rids 97 Sk Vde Sweden June 26 28 1997 Proceedings Lncs 1312

Authors: Andreas Geppert ,Mikael Berndtsson

1997th Edition

3540635165, 978-3540635161

Students also viewed these Databases questions