Answered step by step
Verified Expert Solution
Question
1 Approved Answer
CS 1 6 2 Assignment # 2 The Tune Finder Practice good software engineering design principles: o Design your solution before writing the program o
CS Assignment # The Tune Finder
Practice good software engineering design principles:
o Design your solution before writing the program
o Develop test cases before writing the program
Practice pointers, arrays, dynamic memory usage, and structs
Use file IO to read from and write to files
Practice file separation and create Makefile
Use functions to modularize code to increase readability and reduce repeated code
Problem Statement:
The Melody Management Corporation MMC has recently added a lot of new songs and artists to their
catalog. We have witnessed some artists showcasing exceptional skills in the studio. However, it has
become progressively challenging for the music enthusiasts to locate specific songs or artists they wish
to explore.
In order to alleviate these issues, the corporation has appointed you to develop a music catalog program
that will streamline access control and simplify the process of discovering new tunes. To simplify your
task, the management team has provided you with the songs' profile information. These come in the form
of a playlist file: songsplaylist.txtNOTE: The filename provided from the user inputs should
not be hardcoded in your program!
The songsplaylist.txt file contains a list of MMCs songs and their artists. This file will give you
the song and artist information that your program will organize and display.
Get the skeleton coded
Requirements:
User inputs:
When starting the program, the user will be prompted for two inputs: the first input will be the name
of the playlist file that contains the information about playlists and songs. If the user does not
provide the name of an existing playlist file, the program should print out an error message and
quit. The second input will be the users age. The age must be a positive integer. Reprompt the
user until a valid input is given.
Searching and Printing:
Once the user provides the correct playlist file and their age, they should be prompted with a list of
different ways to display the song and artist information. After the user has chosen an option, they
should be asked if they want the information printed on the screen or written to a file, except for
Display all songs option. If they choose to write to a file, they should be prompted for a file name. If
the file name already exists, the information should be appended to the existing file. If the file name
does not exist, a new file should be created with the provided name, and the informationresult
should be written to this new file.
Available Options:
o Display all Songs:
If the user picks this option, print all song and artist information from the input file on the screen.
Additionally, an age check is required before printing. Specifically, if the user's age is or
below inclusive details of explicit songs those with an E restriction should be hidden. There
is no requirement to include a "writetofile" option in this scenario.
o PlaySearch for a Song:
If the user picks this option, the user will then be prompted for a valid song name. If found, the
song will be played. When the song is playing, you should print or write to file the entire
information of the song including name, artist, genre, length, and restriction level, in a readable
format. No age check is needed for this option.
o Search Songs by Genre:
If the user picks this option, the user will then be prompted for a valid genre. The songs of all the
playlists that have the typed genre will be displayed.
Possible genres are Alternative, Pop, Country, Rock, R&B Jazz, Rap, and Others.
Once a song is found, you should print or write to file the songs entire information in a readable
format. No age check is needed for this option.
o Length of all playlists:
If the user picks this option, the length of each playlist will be calculated and displayed. The
length of a playlist is the sum of the length of all its songs. When displaying a list, you should print
or write to file with the following format. No age check is needed for this option.
Playlist name: Total Length
o Quit:
The program will exit.
Your program should continue running until the user chooses to quit.
Required Structs:
The following structs are required in your program. They will help organize the information that will be
read in or derived from the files. You cannot modify, add, or remove members of the struct.
However, you are welcome to modify the name of the provided member variables if needed.
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