Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Homework 1 Spotify Playlists Before starting this homework, make sure you have read and understood the Academic Integrity Policy. In this assignment you will develop
Homework Spotify Playlists Before starting this homework, make sure you have read and understood the Academic Integrity Policy. In this assignment you will develop a program to manage music playlists like Spotify does, let's call this program New York Playlists. Please read the entire handout before starting to code the assignment. Learning Objectives Practice handling command line arguments. Practice handling file input and output. Practice the C Standard Template Library string and vector classes. Background On Spotify, users can create and manage playlists. On the Spotify app or website, users can navigate to the "Your Library" section and click on the sign to create a playlist. When creating a playlist, users can add music tracks to the playlist. After a playlist is created, users can add new tracks to this playlist, or remove tracks from this playlist. Users can also move tracks to new positions within a playlist. The following two images show the moving process: At first, track is "Perfect Duet", track is "Always Remember Us This Way", track is "Million Reasons", and track is "I'll Never Love Again". alt text Next, we drag track up to right above track After this dragging action, now, track is still "Perfect Duet", track is "I'll Never Love Again", track is "Always Remember Us This Way", and track is "Million Reasons". alt text Command Line Arguments Your program will support commands. Command : add a music track to a playlist The first argument is the name of an input file which contains a playlist. The second argument is the name of another input file which contains all available music tracks. The third argument is the output file. The fourth argument is the action, which in this case is "add". The fifth argument is the title of the music track. nyplaylistsexe playlist.txt library.txt output.txt add title This command will add a music track specified by the title to the end of a playlist. For example, the following command will add the song "Umbrella" to the end of the playlist. nyplaylistsexe playlisttinytxt library.txt output.txt add "Umbrella" Command : remove a music track from a playlist The first argument is the name of an input file which contains a playlist. The second argument is the name of another input file which contains all available music tracks. The third argument is the output file. The fourth argument is the action, which in this case is "remove". The fifth argument is the title of the music track. nyplaylistsexe playlist.txt library.txt output.txt remove title For example, the following command will remove the song "Always Remember Us This Way" from the playlist. nyplaylistsexe playlisttinytxt library.txt output.txt remove "Always Remember Us This Way" Command : move a music track to a new position on the playlist The first argument is the name of an input file which contains a playlist. The second argument is the name of another input file which contains all available music tracks. The third argument is the output file. The fourth argument is the action, which in this case is "move". The fifth argument is the title of the music track. The sixth argument is the new position where this user wants the music track to be located on the playlist. Note that, unliked array indexing in CC positioning in Spotify starts at as opposed to This can be seen in the above Spotify screenshot: the first position is position nyplaylistsexe playlist.txt library.txt output.txt move title newposition For example, the following command will move the song "I Will Never Love Again Film Version" to position nyplaylistsexe playlisttinytxt library.txt output.txt move "I Will Never Love Again Film Version" For all commands, the output.txt contains the updated playlist. We have provided sample input & output files. Examples of using command line arguments can be found on the course webpage: Programming Information. Input and Output File Format All the input files and output files have the same format. Take the playlisttinytxt as an example, this file has the following lines: "Perfect Duet" Ed Sheeran, Beyonce "Always Remember Us This Way" Lady Gaga "Million Reasons" Lady Gaga "I Will Never Love Again Film Version" Lady Gaga, Bradley Cooper Each line has two fields, the music title, and the artists There is one single space separating these two fields. Handling Music Tracks with the Same Title In cases where multiple tracks may have the same title, choose the first track from the input file. This is NOT the natural behavior of Spotify, but this decision is just to simplify your implementation. Known Issue on Submitty The Autograder on Submitty doesn't handle command line arguments correctly when the arguments are enclosed in double quotes. In fact, the autograder would add a backslash as an escape character in front of each
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started