logo Use SA10RAM to get 10%* Discount.
Order Now logo

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

Bryan ThomsonPsychology

819 Answers

Hire Me
Laurence FarrellStatistics

673 Answers

Hire Me
Geoffrey MorrisMathematics

897 Answers

Hire Me
Mehar KhanNursing

758 Answers

Hire Me
C Programming

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


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.

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. 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

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme

Get Free Quote!

290 Experts Online