logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

write a program to keep track of the music you play on your computer.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

CS 262
Project 3
Songs, Playlists and Music Library

In order to further your expertise in the C programming language, you decide to write a program to keep track of the music you play on your computer. You have already ripped many of your favorite songs to your computer, but wish to make an easier way to play the music you want, in the order you want. The first step is to come up with a way to create play lists for your music. Coincidentally, the specifications of your CS 262 Project 3 creates a program that is exactly what you want to do! (Lucky you!). So, using the following specifications will get you started on your goal (after which, you can figure out how to actually play the songs in your play list.)

The Playlist

The playlist will be implemented using a singly linked list. Each node in the linked list represents a song, and it has several data members corresponding to various attributes of the song. Users should be able to create a playlist, add/remove songs to it, search and manipulate the list in convenient ways. Specifically, the playlist should support the following operations:

  • Add song at the end
  • Add song at the beginning
  • Insert a song at a specific position
  • Move a song up one position
  • Move a song down one position
  • Remove a song from the playlist
  • Print the entire playlist
  • Show playlist duration
  • Search a song by its title in the playlist

The structure representing a song-node will be the following:

typedef struct _songnode
{   
  char title[35];
  char artist[35];
  char album[35];
  double duration;
  struct _songnode *next;
} SongNode;

The user will browse a music library in order to find songs which can be added to the user's playlist.

The Music Library

The music library will be implemented using another singly linked list. The user can browse the music library by searching a particular song, or by viewing all songs in alphabetical order. The user may choose to add a song to the user's playlist, in which case, the song will be removed from the library and added to the playlist. If a user removes a song from his playlist, the song is inserted back to the music library in proper alphabetical order.

 

The following operations are supported in the music library:

  • View all songs
  • Search by title
  • Add song to playlist

At the start of the program, a text file will be read to create the music library. Each song will constitute 4 lines in the text file, with each line representing title, artist, album and duration, respectively. Your program will have to read this text file and create the music library by inserting each song information in to the singly linked list, in alphabetical order.

Flow of Operation

At the beginning, the program will create a music library by reading data from a given text file. The name of the text file will be passed as a command line argument. Your program will read information for each song from the text file and insert them in alphabetical order in a singly linked list. This singly linked list is your music library. Initially, the user will have an empty playlist and the music library. The user's playlist will also be a singly linked list. The program will present the user a menu, called the playlist menu.

Playlist Menu

The playlist menu will have the following options:

  1. Print playlist
  2. Show duration
  3. Search by title
  4. Move a song up
  5. Move a song down
  6. Remove a song
  7. Go to Music Library
  8. Quit

The options 3, 4, 5 and 6 ask the user to input a string as song title. If the user chooses option "7. Go to Music Library", then another menu will be displayed, called the library menu.

Library Menu

The library menu will have the following options:

  1. View all songs
  2. Search by title
  3. Add a song to playlist
  4. Back to playlist

The options 2 and 3 will take the song title as input from user. If the user choose to add a song to the playlist, the program will ask for the title of the song and it will do similar operations as "Search by title". If the song is found, a third menu will be displayed, called Add Song Menu.

Add Song Menu

This menu will have the following options:

  1. Add song to the end
  2. Add song at the beginning
  3. Insert song at a specific position

Option 3 will ask the user again to input another non-negative integer value as position. Position values start from 0. If a user enters a negative number as position, the program should ask for a correct value. If the user enter a value larger than the number of songs in the list, then the song is added to the end of the list. Once a song has been selected by the user and added to the playlist, the entire playlist should be printed with an appropriate message. Then the Library Menu will be displayed again.

Details of Implementation

There are two main components in this project- the playlist and the music library. We first describe the implementation of the playlist.

  • The playlist will be a linked list of structures named SongNode, as given above. A pointer to SongNode is used to point to the first element in the list— called a head pointer. You could setup the initial empty linked list with a dummy node, or by making head a NULL pointer— it is a design decision that affects the way you would write the functions for linked list operations, e.g., insertion, deletion, etc.
  • A function createSongNode() will take the song attributes as input parameters and create a struct for the song by allocating memory dynamically. This function returns a pointer to the newly created linked list node, which can be passed to a function called insertSong() as a parameter. This function will insert the new SongNode in to the playlist, in an appropriate position.
  • A function called printList() will take the head pointer as input and it will traverse each SongNode in order. It will print detailed information about each song as it traverses.
(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

546 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

987 Answers

Hire Me
expert
Husnain SaeedComputer science

957 Answers

Hire Me
expert
Atharva PatilComputer science

549 Answers

Hire Me