In this assignment, you are to implement a repository for music. It will hold a series of Playlists, each a doubly-link linked lists of Songs to play.

Part1: A Song Object

  • Design a struct, Time, to hold time information.
    • Should have at least: hours (int), minutes (int), seconds (int)
    • A function to add two Times together and return a new Time equal to the total of the two Times
  • Design a class, Song, which holds the information for a song (for now we will ignore the actual digitized data for the song).
    • Should have at least: title (string), artist (string), runtime (Time)
    • Appropriate constructor(s)
    • Accessor methods to get the title, artist and runtime.
    • Appropriate Mutators as needed.
  • Test these to make sure they work.

Part 2: The Playlist

  • Design a struct, SongNode, that represents a node in a Doubly Linked List
    • Should have at least: song (Song), next (pointer to a SongNode), 
prev(pointer to a SongNode).
    • You will not need to define next or prev if you use the STL list, but 
you will if you design your own Linked List. In either case, you will 
need a SongNode struct (please see examples 24,25).
  • Design a class, Playlist, which represents a playlist of Songs. The list of songs 
is represented as a Doubly linked list of SongNodes.
    • Should have at least: title (string), head (pointer to SongNode), tail 
(pointer to SongNode), numsongs (int), totalPlayTime (Time)
    • Appropriate constructor(s)
    • Appropriate destructor
    • A method to add a Song to the list
    • A method to loadSongs from a Dynamic Pointer Based Array (An 
array that can grow) or vector.
    • A method to find a Song in the list
    • A method to remove a Song from the list
    • A list method to list all the Songs in the Playlist in the current order
    • A method to move a song from a playlist to another playlist
    • Sort method(s) to allow sorting of the Playlist by Song title or Song artist.
  • Read the data file provided loading the file into a dynamic array (or a vector 
if you wish). Once you have loaded the array or vector, you will instantiate a new list and pass to it a smaller array or vector of a maximum of 10 songs that would be copied into the list using the method loadSongs() mentioned in 2(e) above. The newly instantiated playlist would in turn copy it into the doubly linked list of songs of that particular playlist. Your last playlist may contain less than 10 songs. It is up to you whether you would like to limit the number of songs in a playlist to 10 as a rule, or you would like to restrict this rule to the loading from file process (the latter case is easier). As you instantiate new lists, you need to give them names that could be modified later using a setPlayListName within the playlist class. Also, remember that a Song should not exist twice within the same playlist.
  • Something we will skip in this assignment: ideally, your changes to playlists (adding songs, moving songs, deleting songs, renaming of playlists, etc) should be saved and reloaded the next time you start your newly designed music program – but this will be too much work for this assignment) – we will maintain the changes while things are loaded in memory only (we will not load the lists from newly generated files).
  • However, you need to include a function in your program, that will produce a master output file, that will look exactly as the format of the input file provided, but it adds the name of the list as: See image.
  • You should have an id for each playlist and an id for each song (at the overall system level). (Hint: Think of static variables for a playlist id, but you can select to manage this on your own if it is easier for you by incrementing the playlist id every time you instantiate a new list (every 10 songs)). A songId in a playlist may just indicate a unique number of the Song.
  • Test your code with some examples and Provide Screenshots for all the scenarios above.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.