Question
In C++ for Linux program: Create file that stores catalog of records, then create menu and be able to write to that file. Suppose that
In C++ for Linux program: Create file that stores catalog of records, then create menu and be able to write to that file.
Suppose that over the years you collected some music CDs and vinyl records, so its time to keep track of your music. Your job is to read a text file into memory that contains the music collection, so it can be displayed, searched, etc. To do this, I would like your program to use a user-controlled loop where the user can search for a specific album (CD or record), list all the albums stored in memory, add a new album (to memory only, not to the file), or quit. See below for file format details and sample output.
Input File Format
For this assignment, the file that your program will load contains a few details about the albums in your collection. Specifically,
- the file will contain the name of the album, the band name, the release date
- the type (CD, vinyl, tape, etc.)
- the album number. The album number is based on how many albums they have produced. If the album is the artists 3rd, for example, then the album number is 3.
Use a single line to store all the data about a single album. An example file will be provided with the assignment, but you may create your own. Please do not include headers, a file description, or other non-data information in the file.
Use commas to separate the data items on each line of the file. Like this:
Pork Soda,Primus,1993,CD,3
Vitalogy,Pearl Jam,1994,CD,3
Example Output (User Input in Bold):
Welcome to the music database program. What is the name of the album database file? notAFile.txt
notAFile.txt was not found. Type quit to exit the program.
What is the name of the album database file? CDsAndRecords.txt
Successfully loaded 5 albums.
Name Band Release Date Type Album number
---------------------------------------------------------------
Pork Soda Primus 1993 CD 3
Vitalogy Pearl Jam 1994 CD 3
What would you like to do? (S)earch for an album, (A)dd an album, (L)ist all albums, or (Q)uit? A
What is the name of the album? Houses of the Holy
What is the band name? Led Zeppelin
What is the release date? Nineteen Seventy Three
That is not a number. Please enter a date in numeric form.
What is the release date? 1973
What is the type of the album (CD, vinyl, tape, etc.)? vinyl
What is the album number? 5
Successfully added Houses of the Holy to the database.
What would you like to do? (S)earch for an album, (A)dd an album, (L)ist all albums, or (Q)uit? S
What is the name of the album? Soup
Information on the album Soup is as follows:
Band: Blind Melon, Release Date: 1994, Type: CD, Album number: 2.
What would you like to do? (S)earch for an album, (A)dd an album, (L)ist all albums, or (Q)uit? S
What is the name of the album? Briefcase Full of Blues
Error, unable to find Briefcase Full of Blues in the album database.
What would you like to do? (S)earch for an album, (A)dd an album, (L)ist all albums, or (Q)uit? L
Name Band Release Date Type Album number
---------------------------------------------------------------
Pork Soda Primus 1993 CD 3
Vitalogy Pearl Jam 1994 CD 3
Houses of the Holy Led Zeppelin 1973 vinyl 5
What would you like to do? (S)earch for an album, (A)dd an album, (L)ist all albums, or (Q)uit? Q
Terminating Program.
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