Question: This needs to be done in C++. My main struggle is just getting the file to even load to the doubly linked list. the file

This needs to be done in C++. My main struggle is just getting the file to even load to the doubly linked list.

the file is formatted like this:

Taylor Swift,1989,Shake it Off,Pop,3:35,12,3 Disturbed,THE SICKNESS,Down With The Sickness,Hard Rock,4:39,8,4 Drake,NOTHING WAS THE SAME,Own It,Rap,3:23,3,3 Disturbed,ASYLUM,Asylum,Hard Rock,4:36,2,4 Drake,YOU WELCOME,The Motto,Rap,4:13,7,4 Christina Perri,HEAD OF HEART,Trust,Pop,2:35,3,5 Justin Bieber,PURPOSE,No Sense,Pop,4:12,6,1 Eminem,SHADYXV,Vegas,Rap,3:37,8,3 Adele,25,Remedy,Pop,4:11,24,4 Disturbed,INDESTRUCTIBLE,The Night,Hard Rock,4:46,7,3 Taylor Swift,RED,Stay Stay Stay,Pop,4:42,5,1 Garth Brooks,FRESH HORSES,The Old Stuff,Country,2:57,11,2 Nirvana,NEVERMIND,Come As You Are,Grunge,3:38,5,4 Eminem,8 Mile,Lose Yourself,Rap,5:24,12,5 Five Finger Death Punch,American Capitalist,Back For More,Hard Rock,2:34,8,4 Disturbed,INDESTRUCTIBLE,Indestructible,Hard Rock,4:38,11,5

Digital Music Manager

Learner Objectives

At the conclusion of this programming assignment, participants should be able to:

  • Design and implement a dynamic doubly linked list
  • Allocate and deallocate memory at runtime
  • Manipulate links in a dynamic list
  • Insert items into a dynamic linked list
  • Edit items in a dynamic linked list
  • Traverse a dynamic linked list

Acknowledgements

Content used in this assignment is based upon information in the following sources:

  • Nadra Guizani, Washington State University CptS122, Data Structures

Overview and Requirements

Many of us have large digital music collections that are not always very well organized. It would be nice to have a program that would manipulate our music collection based on attributes such as artist, album title, song title, genre, song length, number times played, and rating. For this assignment, you will write a basic digital music manager (DMM). Your DMM program must have a text-based interface which allows the user to select from the main menu of options that includes (1) load, (2) store, (3) display, (4) edit, (5) rate, (6) play, (7) delete, (8) insert (9) sort, (10) reverse, (11) shuffle and (99) exit.

Program Details

What must the main menu contain?

The main menu displays the following commands:

 

[ 1 ] Load [ 7 ] Delete [ 2 ] Store [ 8 ] Insert [ 3 ] Display [ 9 ] Sort [ 4 ] Edit [ 10 ] Reverse [ 5 ] Rate [ 11 ] Shuffle [ 6 ] Play [ 99 ] Exit

After a command is selected and complete, your program must display the main menu again. The program will only end when the exit command is selected.

What must Load do?

The load command must read all records from a file called musicPlayList.csv into a dynamic doubly linked list. The doubly linked list is considered the main playlist. As each record is read from the file, it must be inserted at the back of the list. Each record consists of the following attributes:

  • Artist (a string)
  • Album title (a string)
  • Song title (a string)
  • Genre (a string)
  • Song Length (struct Duration type consisting of seconds and minutes)
  • Number of times played (an int)
  • Rating (1 to 5) (an int)

Note: Also create a default constructor

Each attribute, in a single record, will be separated by a comma in the .csv file. This means that you will need to design an algorithm to extract the required attributes for each record. Each field in each record will have a value. You do not need to check for null or empty values. The above attributes are defined by the struct Record.

Song Length will be represented by the struct Duration. Duration is defined as follows:

  • Minutes (an int)
  • Seconds (an int)

Note: Also create a default constructor

Each struct Node in the doubly linked list must be defined as:

  • Data, a struct Record type
  • Pointer to the next node
  • Pointer to the previous node
  • Create a constructor that accepts three parameters: 1) Record type, 2) Node*, and 3) Node*. These will be used to initialize the values in the struct. Assign all three parameters with default values. The Node pointers will have a default value of nullptr. The Record parameter can be assigned with a call to the constructor Record().

What must Store do?

The store command writes the current records, in the dynamic doubly linked list, to the musicPlayList.csv file. The store will completely overwrite the previous contents in the file.

What must Display do?

The display command prints records to the screen. This command MUST support two methods, one of which is selected by the user:

  1. Print all records.
  2. Print all records that match an artist.

What must Edit do?

The edit command MUST allow the user to find a record in the list by the artist. If there are multiple records with the same artist, then your program must prompt the user which one to edit. The user may modify all of the attributes in the record.

What must Rate do?

The rate command MUST allow the user to assign a value of 1 to 5 to a song; 1 is the lowest rating and 5 is the highest rating. The rating will replace the previous rating.

What must Play do?

The play command MUST allow the user to select a song and must start playing each song in order from the current song. Playing the song for this assignment means displaying the contents of the record that represents the song for a short period of time, clearing the screen and showing the next record in the list, etc. This continues until all songs have been played.

What must Delete do?

The delete command MUST prompt the user for a song title, and remove the matching record from the list. If the song title does not exist, then the list remains unchanged.

What must Insert do?

The insert command MUST prompt the user for the details of a new record. The prompt must request the artist name, album title, song title, genre, song length, number of times played, and rating. Then prompt the user where to insert the record, front or back of the list. Add the new record based on the user response.

What must Shuffle do?

The shuffle command MUST provide a random order in which the songs are played. This command MUST not modify the links in the list. It must just specify the order in which songs are played, based on the position of the song in the list. For example, lets say we have a list with 5 songs at positions 1 - 5 in the list, shuffle must generate an order 1 -5 in which the songs are played. An order 2, 5, 3, 1, 4 would require that the second song in the list is played first, the fifth song in the list is played second, the third song in the list is played third, the first song in the list is played fourth, and the fourth song in the list is played fifth. The songs are accessed by traversing the list both forwards and backward to satisfy the order. Hence, the need for a doubly-linked list.

What must Reverse do?

The reverse command MUST modify the links in the list so that it will be in reverse order. This should be easier to do in a doubly linked list since you have a head and tail pointer. However, as a challenge in your spare time, you should also be able to reverse a singly linked list in one pass.

What must Sort do?

The sort command MUST prompt the user for 4 different methods to sort the records in the list. These include:

  1. Sort based on artist (A-Z)
  2. Sort based on album title (A-Z)
  3. Sort based on rating (1-5)
  4. Sort based on times played (largest-smallest)

Once a sort method is selected by the user, the sort must be performed on the records in the list. Use whatever sorting algorithm you want to use: bubble sort, insertion sort, selection sort, merge sort or quicksort.

What must Exit do?

The exit command saves the most recent list to the musicPlayLIst.csv file. This command will completely overwrite the previous contents in the file.

Class Implementation of a Doubly Linked List

You MUST use a class to represent the music playlist which is implemented under the hood as a doubly-linked list. Below is the class MusicPlaylist shell that you MUST use as your starter class for this assignment.

 

class MusicPlaylist { public: // Member Functions you need to implement based on the // requirements of the program. private: Node *mHead; Node *mTail; int mSize; // Keeps track of the number of record in the playlist };

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!