Question: 25.1 Homework 1 - S 21 - Linked Lists The purpose of this assignment is to developed the code to manage a music playlist. The

 25.1 Homework 1 - S 21 - Linked Lists The purpose
of this assignment is to developed the code to manage a music
playlist. The playlist has to be implemented as a doubly linked list.
The code for the assignment is organized as follows: Class Song This
class provides the abstraction for an individual song, including song title, artist,

25.1 Homework 1 - S 21 - Linked Lists The purpose of this assignment is to developed the code to manage a music playlist. The playlist has to be implemented as a doubly linked list. The code for the assignment is organized as follows: Class Song This class provides the abstraction for an individual song, including song title, artist, album, year of publication, and play time in seconds. The class further provides a method printSong, which displays relevant information for a Song Code is provided in Song hand Song.cpp. Students should not modify these files, but use 'as is' Class MusicLibrary This class provides the abstraction and implementation for a Music Library, including reading Songs from a file and storing them in the library Code is provided in MusicLibrary and MusicLibrary.cpp. Students should not modify these files, but use 'as is' Class Playlist This class provides the abstraction for the Playlist. A Playlist is managed as a double linked list, with the content being a pointer to a Song in the Music Library The abstraction for the linked list node is in the class PlaylistEntry(le PlayListEntry) The header file PlayList.h is fully implemented and does not require any changes. All the work is expected to happen in the file PlayList.cpp, Specifically, students are expected to implement the following functionality implement the method appendSong which appends a Song to the doubly linked list. This function is expected to allocate a new Playlist Entry object correctly store the pointer to the song in the object, update the prev and next pointers in the new PlayListEntry as well as already existing PlaylistEntry s (if required), update the number of Songs and the total playtime of the Playlist, as well as the pointers to the first and the last song in the Playlist (if required) Difficulty level 3 (scale 1-5) Implement the method 'getSongo wnich returns a pointer to n-th node in the linked with being provided as an input argument. If the linked list does not contain a nodes and no pointer to a Song can be returned the function is expected to return an error message, en if the playlist contains 4 Songs but the code requests song at Position 5 Cannot return Song at position 5 numsonge 4. Notethe first song in the linked list is at position 0. Difficulty level 2 (scale 1-5) implement the method deleteSong the method is expected to identify a PlayListEntry given a pointer to a Song, remove the corresponding PlayListEntry from the linked list correctly (ie, making sure that all prev and next pointers of nearby elements are correctly updated, and numSongs and playTime is updated correctly) If the playlist is empty, the function is expected to return the error Could not find Song. Playlist is empty. If the song identified by the pointer is not part of the playlist, the function is expected to return the error message: Could not find Song in Playlist. Difficulty level: 3 (scale 1-5) implement method pritlist which invokes the printSong) method of each Song in the playlist in the same order as stored in the playlist Difficulty level 2 (scale 1-5) Implement the method moveUp()' which moves a song identified by a PlaylistEntry pointer one sport up in the playlist. If the Song identified by the PlayListEntry is already the first song in the list the function is expected to output already at top of playlist, cannot move up. and no changes to the linked list are performed Difficulty level 4 scale 1-5) . implement the copy constructor of the Playlist class Difficulty level 4 scale 1-5) Implement the method reverseOrder This function is expected reverse the order songs in the playlistie the last song becomes the first song, the second last song will be the second song the first song becomes the last song Difficulty level 45 scale 1-5) Class PlayListEntry This class provides the abstraction required to manage songs in double linked list implemented in the Playlist class. Code is provided in PlayListentryh Students should not modify this files, but use as is main.cpp A main file providing some examples on how the Playlist class is expected to be used is provided You will most likely have to make changes to this file as part of the development process (e.g. to test some of the functions that you developed in more details), but please DO NOT upload your modification main.cpp to zybooks. The original main.cpp file is expected as part of the zybook tests IMPORTANT Classes and methods names must match exactly for unit testing to succeed Submissions with hard coded answers will receive a grade of o Late submission penalty Code submitted within 24 hours after the deadline will receive a 20% penalty Code submitted within 48 hours after the deadline will receive a 40' penalty . 30100 LAS ACTIVITY 25.1.1 Homework 1 S 21 Linked Lists 0/100 Submission Instructions Downloadable filed main.cpp Musiclibrary.h Musictibrary.cpp Song.h song.cpp Download Playlist Entry. Playlist. Playst.cpp songs-long.txt Comple command att main.cpp Musiclibrary.cpp song.cpp playlist.cpp Wall a.out We will use this command to comode your code es PlayList.cpp 1 #include #include "Playlist.h" main.cpp > MusicLibrary.cpp Playlist::Playlist () 4 5 6 Musiclibrary.h Playlist.cpp D PlayList.h D PlayListEntrych firstSong=nullptr: lastSong-nullptr; numSongs - e; playTime -e; 11 Playlist::PlayList(Playlist& other) Song.cpp 6 Song.h Dsongs-long.txt implement copy-constructor this->firstSong - other firstSong: this->lastSong - other. lastSong; this->num Songs - other. numSongs; this->playTime other playTime; 3 Playlist::-Playlist 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 implement destructor Int Playlist::getPlaylistLength() const { return playTime; int Playlist::getilum Songs() const { return nun Songs, } void Playlist::printlist() const 17 implement printListo) 35 36 37 38 39 40 41 42 43 44 45 PlaylistEntry Playlist::getSong( const int pos) W implenent get song(). les 0 0 main.cpp Musiclibrary.cpp PlayList.cpp 30 { 31 return numSongs: 32 } 33 34 void Playlist::printtist() const 35 { 36 A implement printliste) 37 } D MusicLibrary.h Playlist.cpp 38 PlayList.h 39 40 D PlayListEntrych Song.cpp Song.h PlayListEntry "Playlist::getSong( const int pos ) { W Implement getSong) 2 D songs-long.txt void Playlist::appendSong(Song song) { // implement appendSong } 41 42 43 44 45 46 47 48 49 se 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 void Playlist::deleteSong (Song song) { 11 implement deleteSong if (firstSong -- NULL || song == NULL) return; if (lastSong Song) song - Song>next; ) void Playlist::moveUp (PlaylistEntry *song) 17 implement moveUp } 66 void Playlist: treverseOrder() 67 68 69 70 1 Implement function reversing the order of Songs 71 72 25.1 Homework 1 - S 21 - Linked Lists The purpose of this assignment is to developed the code to manage a music playlist. The playlist has to be implemented as a doubly linked list. The code for the assignment is organized as follows: Class Song This class provides the abstraction for an individual song, including song title, artist, album, year of publication, and play time in seconds. The class further provides a method printSong, which displays relevant information for a Song Code is provided in Song hand Song.cpp. Students should not modify these files, but use 'as is' Class MusicLibrary This class provides the abstraction and implementation for a Music Library, including reading Songs from a file and storing them in the library Code is provided in MusicLibrary and MusicLibrary.cpp. Students should not modify these files, but use 'as is' Class Playlist This class provides the abstraction for the Playlist. A Playlist is managed as a double linked list, with the content being a pointer to a Song in the Music Library The abstraction for the linked list node is in the class PlaylistEntry(le PlayListEntry) The header file PlayList.h is fully implemented and does not require any changes. All the work is expected to happen in the file PlayList.cpp, Specifically, students are expected to implement the following functionality implement the method appendSong which appends a Song to the doubly linked list. This function is expected to allocate a new Playlist Entry object correctly store the pointer to the song in the object, update the prev and next pointers in the new PlayListEntry as well as already existing PlaylistEntry s (if required), update the number of Songs and the total playtime of the Playlist, as well as the pointers to the first and the last song in the Playlist (if required) Difficulty level 3 (scale 1-5) Implement the method 'getSongo wnich returns a pointer to n-th node in the linked with being provided as an input argument. If the linked list does not contain a nodes and no pointer to a Song can be returned the function is expected to return an error message, en if the playlist contains 4 Songs but the code requests song at Position 5 Cannot return Song at position 5 numsonge 4. Notethe first song in the linked list is at position 0. Difficulty level 2 (scale 1-5) implement the method deleteSong the method is expected to identify a PlayListEntry given a pointer to a Song, remove the corresponding PlayListEntry from the linked list correctly (ie, making sure that all prev and next pointers of nearby elements are correctly updated, and numSongs and playTime is updated correctly) If the playlist is empty, the function is expected to return the error Could not find Song. Playlist is empty. If the song identified by the pointer is not part of the playlist, the function is expected to return the error message: Could not find Song in Playlist. Difficulty level: 3 (scale 1-5) implement method pritlist which invokes the printSong) method of each Song in the playlist in the same order as stored in the playlist Difficulty level 2 (scale 1-5) Implement the method moveUp()' which moves a song identified by a PlaylistEntry pointer one sport up in the playlist. If the Song identified by the PlayListEntry is already the first song in the list the function is expected to output already at top of playlist, cannot move up. and no changes to the linked list are performed Difficulty level 4 scale 1-5) . implement the copy constructor of the Playlist class Difficulty level 4 scale 1-5) Implement the method reverseOrder This function is expected reverse the order songs in the playlistie the last song becomes the first song, the second last song will be the second song the first song becomes the last song Difficulty level 45 scale 1-5) Class PlayListEntry This class provides the abstraction required to manage songs in double linked list implemented in the Playlist class. Code is provided in PlayListentryh Students should not modify this files, but use as is main.cpp A main file providing some examples on how the Playlist class is expected to be used is provided You will most likely have to make changes to this file as part of the development process (e.g. to test some of the functions that you developed in more details), but please DO NOT upload your modification main.cpp to zybooks. The original main.cpp file is expected as part of the zybook tests IMPORTANT Classes and methods names must match exactly for unit testing to succeed Submissions with hard coded answers will receive a grade of o Late submission penalty Code submitted within 24 hours after the deadline will receive a 20% penalty Code submitted within 48 hours after the deadline will receive a 40' penalty . 30100 LAS ACTIVITY 25.1.1 Homework 1 S 21 Linked Lists 0/100 Submission Instructions Downloadable filed main.cpp Musiclibrary.h Musictibrary.cpp Song.h song.cpp Download Playlist Entry. Playlist. Playst.cpp songs-long.txt Comple command att main.cpp Musiclibrary.cpp song.cpp playlist.cpp Wall a.out We will use this command to comode your code es PlayList.cpp 1 #include #include "Playlist.h" main.cpp > MusicLibrary.cpp Playlist::Playlist () 4 5 6 Musiclibrary.h Playlist.cpp D PlayList.h D PlayListEntrych firstSong=nullptr: lastSong-nullptr; numSongs - e; playTime -e; 11 Playlist::PlayList(Playlist& other) Song.cpp 6 Song.h Dsongs-long.txt implement copy-constructor this->firstSong - other firstSong: this->lastSong - other. lastSong; this->num Songs - other. numSongs; this->playTime other playTime; 3 Playlist::-Playlist 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 implement destructor Int Playlist::getPlaylistLength() const { return playTime; int Playlist::getilum Songs() const { return nun Songs, } void Playlist::printlist() const 17 implement printListo) 35 36 37 38 39 40 41 42 43 44 45 PlaylistEntry Playlist::getSong( const int pos) W implenent get song(). les 0 0 main.cpp Musiclibrary.cpp PlayList.cpp 30 { 31 return numSongs: 32 } 33 34 void Playlist::printtist() const 35 { 36 A implement printliste) 37 } D MusicLibrary.h Playlist.cpp 38 PlayList.h 39 40 D PlayListEntrych Song.cpp Song.h PlayListEntry "Playlist::getSong( const int pos ) { W Implement getSong) 2 D songs-long.txt void Playlist::appendSong(Song song) { // implement appendSong } 41 42 43 44 45 46 47 48 49 se 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 void Playlist::deleteSong (Song song) { 11 implement deleteSong if (firstSong -- NULL || song == NULL) return; if (lastSong Song) song - Song>next; ) void Playlist::moveUp (PlaylistEntry *song) 17 implement moveUp } 66 void Playlist: treverseOrder() 67 68 69 70 1 Implement function reversing the order of Songs 71 72

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!