Create a program that implements a music playlist using structures and files. The program must continue to run until the user picks exit.
Instructions: Kindly create a C language program and refer for the expected program output below: (I won't like your solution if there is any error, not properly debugged.)
Successfully loaded data!
======= MENU =======
[1] Add Playlist
[2] Add Song to Playlist
[3] Remove Song from Playlist
[4] View a Playlist
[5] View All Data
[6] Exit
Enter choice: 3
There are no playlists yet!
-----------------------------
======= MENU =======
[1] Add Playlist
[2] Add Song to Playlist
[3] Remove Song from Playlist
[4] View a Playlist
[5] View All Data
[6] Exit
Enter choice: 1
Enter playlist name: Taylor <3
Successfully added playlist!
-----------------------------
======= MENU =======
[1] Add Playlist
[2] Add Song to Playlist
[3] Remove Song from Playlist
[4] View a Playlist
[5] View All Data
[6] Exit
Enter choice: 1
Enter playlist name: Favorites <3
Successfully added playlist!
-----------------------------
======= MENU =======
[1] Add Playlist
[2] Add Song to Playlist
[3] Remove Song from Playlist
[4] View a Playlist
[5] View All Data
[6] Exit
Enter choice: 1
Enter playlist name: Taylor <3
Playlist name already exists!
-----------------------------
======= MENU =======
[1] Add Playlist
[2] Add Song to Playlist
[3] Remove Song from Playlist
[4] View a Playlist
[5] View All Data
[6] Exit
Enter choice: 5
PLAYLIST: Taylor <3
SONG COUNT: 0
PLAYLIST: Favorites <3
SONG COUNT: 0
-----------------------------
======= MENU =======
[1] Add Playlist
[2] Add Song to Playlist
[3] Remove Song from Playlist
[4] View a Playlist
[5] View All Data
[6] Exit
Enter choice: 2
THE PLAYLIST AVAILABLE ARE:
[0] Taylor <3
[1] Favorites <3
Enter playlist number: 3
Invalid playlist!
-----------------------------
======= MENU =======
[1] Add Playlist
[2] Add Song to Playlist
[3] Remove Song from Playlist
[4] View a Playlist
[5] View All Data
[6] Exit
Enter choice: 2
THE PLAYLIST AVAILABLE ARE:
[0] Taylor <3
[1] Favorites <3
Enter playlist number: 0
Enter song title: Sparks Fly
Enter song artist: Taylor Swift
Enter song album: Speak Now
Successfully added song to playlist!
-----------------------------
======= MENU =======
[1] Add Playlist
[2] Add Song to Playlist
[3] Remove Song from Playlist
[4] View a Playlist
[5] View All Data
[6] Exit
Enter choice: 2
THE PLAYLIST AVAILABLE ARE:
[0] Taylor <3
[1] Favorites <3
Enter playlist number: 0
Enter song title: Invisible String
Enter song artist: Taylor Swift
Enter song album: folklore
Successfully added song to playlist!
-----------------------------
======= MENU =======
[1] Add Playlist
[2] Add Song to Playlist
[3] Remove Song from Playlist
[4] View a Playlist
[5] View All Data
[6] Exit
Enter choice: 5
PLAYLIST: Taylor <3
SONG COUNT: 2
SONG TITLE: Sparks Fly
SONG ARTIST: Taylor Swift
SONG ALBUM: Speak Now
SONG TITLE: Invisible String
SONG ARTIST: Taylor Swift
SONG ALBUM: folklore
PLAYLIST: Favorites <3
SONG COUNT: 0
-----------------------------
======= MENU =======
[1] Add Playlist
[2] Add Song to Playlist
[3] Remove Song from Playlist
[4] View a Playlist
[5] View All Data
[6] Exit
Enter choice: 4
THE PLAYLIST AVAILABLE ARE:
[0] Taylor <3
[1] Favorites <3
Enter playlist number: 0
PLAYLIST: Taylor <3
SONG COUNT: 2
SONG TITLE: Sparks Fly
SONG ARTIST: Taylor Swift
SONG ALBUM: Speak Now
SONG TITLE: Invisible String
SONG ARTIST: Taylor Swift
SONG ALBUM: folklore
-----------------------------
======= MENU =======
[1] Add Playlist
[2] Add Song to Playlist
[3] Remove Song from Playlist
[4] View a Playlist
[5] View All Data
[6] Exit
Enter choice: 3
THE PLAYLIST AVAILABLE ARE:
[0] Taylor <3
[1] Favorites <3
Enter playlist number: 1
Playlist is still empty!
-----------------------------
======= MENU =======
[1] Add Playlist
[2] Add Song to Playlist
[3] Remove Song from Playlist
[4] View a Playlist
[5] View All Data
[6] Exit
Enter choice: 3
THE PLAYLIST AVAILABLE ARE:
[0] Taylor <3
[1] Favorites <3
Enter playlist number: 0
THE SONG AVAILABLE ARE:
[0] Sparks Fly by Taylor Swift
[1] Invisible String by Taylor Swift
Enter song number to delete: 3
Invalid song number!
-----------------------------
======= MENU =======
[1] Add Playlist
[2] Add Song to Playlist
[3] Remove Song from Playlist
[4] View a Playlist
[5] View All Data
[6] Exit
Enter choice: 3
THE PLAYLIST AVAILABLE ARE:
[0] Taylor <3
[1] Favorites <3
Enter playlist number: 0
THE SONG AVAILABLE ARE:
[0] Sparks Fly by Taylor Swift
[1] Invisible String by taylor Swift
Enter song number to delete: 0
Successfully deleted song!
-----------------------------
======= MENU =======
[1] Add Playlist
[2] Add Song to Playlist
[3] Remove Song from Playlist
[4] View a Playlist
[5] View All Data
[6] Exit
Enter choice: 3
THE PLAYLIST AVAILABLE ARE:
[0] Taylor <3
[1] Favorites <3
Enter playlist number: 0
THE SONG AVAILABLE ARE:
[0] Invisible String by taylor Swift
Enter song number to delete: 0
Successfully deleted song!
-----------------------------
======= MENU =======
[1] Add Playlist
[2] Add Song to Playlist
[3] Remove Song from Playlist
[4] View a Playlist
[5] View All Data
[6] Exit
Enter choice: 5
PLAYLIST: Taylor <3
SONG COUNT: 0
PLAYLIST: Favorites <3
SONG COUNT: 0
-----------------------------
![Create a program that implements a music playlist using structures and
files. The program must continue to run until the user picks exit.
Functionalities:
1. Create two structures. One for the playlist with the details:
name, song count, array of songs (size 10) and one for the song
with the details: title, artist, album.
2. The program must load the data each time it is ran and must save
the data each time the user picks exit.
(a) Save Data
You must check whether there is a data to be saved. If
there are none, simply print a prompt saying so. Also,
save count as 0 so that you will be able to keep track
if file is empty.
The format of the saved data must follow this:
Total Count of the Playlists
Name of Playlist 1.
Number of Songs in Playlist 1
Title of Song 1
Artist of Song 1
Album of Song 1
Title of Song 1
Artist of Song 1
Album of Song 1
Name of Playlist 2
Number of Songs in Playlist 2
Load Data
You must check whether the file exists. If the file
exists, check if the count is 0. If the count not 0,
read each of the data in the file and save it in array
of structures.
The user can put up to 10 playlists in the system.
Make sure to check if the system is not yet full.
If the system is not yet full, ask for the details of
the playlist, and initiallize the song count to 0.
Remember to check that the name of the playlist is
unique. If the name already exists, it musn't be added
to the system.
If the system is full, simply say that it is.
(b)
3. Create a menu that shows:
(a) Add Playlist
(b)
Add Song to Playlist
Make sure to check if there a playlist to add to. Ask
which playlist to add the song to. If the playlist
exists and it doesn't have 10 songs yet, ask for the
details of the song. Else, print the appropriate
prompts.
(c)
Remove Song from Playlist
Make sure to check if there is a playlist to remove
from. Ask which playlist to remove songs from. If the
playlist exists, and it isn't empty, ask which song to
remove. If found, remove the song. Else, print the
appropriate prompts.
(d)
View a Playlist
Make sure to check if there is a playlist to print.
Ask which playlist to print. If the playlist exists,
print all the details about it along with the songs.
Else, print the appropriate prompts.
(e) View all Data
This simply prints all of the available data in the
system. Both the playlists and songs. Make sure to
check if there is data to print.
(f)
Exit
- When the user picks this, the program terminates.
4. Each choices except for the exit must be implemented inside a
function. You also need to put save () and load() inside a
function.
5. Do not forget to put documentation in your code.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F13d28389-bf8b-4b0a-9d90-fa54be10c5ab%2Fc5fcef3d-2034-46f0-be1e-c571cf619864%2Fwess7h_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 5 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)