Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ problem This problem focuses on implementing a linked list. Turn in a file named songcatalog.epp zipped in a folder called problem1. You will need

c++ problem
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
This problem focuses on implementing a linked list. Turn in a file named songcatalog.epp zipped in a folder called problem1. You will need to support classes Song, and SongList (skeleton classes are provided below and in a skeleton.cpp file along with a possible driver), and songs.txt (provided along with this assignment). The provided skeleton file will not compile without your solution or commenting some functions. Feel free to add methods to class when needed and to modify the driver You are required to develop a software that will let a user organize his or her music collection. Instead of a databese you will be storing all the information in a file. Your program will be an interface to this file and provide a database-like functionality. The user of your program will be able to add songs to the file, delete songs, search for songs, or display everything on file. The songs will be stored in a file called songa.txt. The format of each song has been deliberately kept simple. The songs are kept in sorted order in the file. Songs are sorted by artist and then title Artist: The Beatles Title: The Fool on the Hill In your program you will read in the data from the file, create a Song object for each song and store these objects in a Linked List that you develop. Your program will be menu driven. The menu will be of the following form: Song Catalog Menu 1. Import songs from a file 2. Add a song 3. Delete a song 4. Search for a song 5. Get a song by title 6. Get all songs by artist 7. Display all songs 8. Exit program Enter selection (1 8) If the user does not enter a valid selecetion, i.e a number between I and 8 inclusive you will reprint the menu For valid menu selection you will handle each case separately 1. Import Songs from a File: You will prompt the user to enter the absolute path name to the file. Check if the file exists and is readable. The format for the data must be in the same form as zongs.txt. Read the contents of the file and populate the List. Once you have processed the request reprint the menu 2. Add a new song: You will prompt the user to enter the name of the artist and the title of the song. Enter artist: Enter title: If that song is already there, print a message to that effect. Ifthe songu 0t there you will insert the soagun its rightful place in the sorted list of songs. You will be using a variation of insertion sort for doing that. After you have processed this request you will reprint the main menu 3. Delete a song: You will prompt the user to enter if the deletion will be by artist or title. For invalid entries prompt the user again. Depending on the valid response that you get, prompt the user to enter either the name of the artist or the title of the song Delete by areist or title (A or I):A Enter arcist: If the deletion is by artist name you will delete all songs by that artist. If the deletion is by song title, thea you will delete only the entry for that song. If the artist or the title does not exist, you will write a message to that effect. Atter you have processed this request you will reprint the main menu. 4. Search for (a) song(s): You will prompt the user to enter if the search will be by artist or title. For invalid entries prompt the user again. Depending on the valid response that you get, prompt the user to enter either the name of the artist or the title of the song Search by artist or title (A or I): T Enter title: If the search is by artist name, you will display all songs by that artist in the collection. If the search is by title you will display the name of the artist and the title in the collection. If the artist or the title does not exist then you will write a message to that effect. After you have processed this request you will reprint the main menu 5. Get a song by title: You will prompt the user to enter a title then return a Song object of this title without deleting it from the main song list. Return mull of such a song does not exist. After you have processed the request you will reprint the main menu Enter title: 6. Get all songs by artist: You will prompt the user to enter an artist then you will return a list of all songs by a given artist without deleting tem tom the main list. Retumaull ifthe artist does t have any song. After getting the list you should display it by invoking on the returned SongList object the displayCatalogue) method from the Songlist class (see skeleton below) After you have processed the request you will reprint the main menu Enter artist: 7. Display all songs: You will display all songs in the list. After you have processed the request you will reprint the main menu 8. Exit program: You will over-write the file songs.txt with the modified list of songs in the original format. You will a message thanking the user for using the software A skeleton of the code (classes Song and SongList) is provided below to get you started. If deemed necessary, you can do some changes such as adding some helper methods or changing the signatures of some methods. class Songt private: string artist string title: Songt next: public: // define a constructor to initialize artist and title but next to null Song(string artist,string title) /1 define a constructor to initialize artist, title, and next to another //song object Song (string artist,string title, Songt next): // define a deafault constructor Song ): /I compareTo two song abjects first by artist and then by title //return 0 if they are equal //return 0 if this object is greater than other int compareTo (Songt other) ; //print the object in a format Artist: artist InTitle: title such as //Artist: The Beatles //Title: The Fool on the Hill friend ostreani operator

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Select Healthcare Classification Systems And Databases

Authors: Katherine S. Rowell, Ann Cutrell

1st Edition

0615909760, 978-0615909769

More Books

Students also viewed these Databases questions

Question

How appropriate would it be to conduct additional research?

Answered: 1 week ago

Question

Who are credible sources and opinion leaders for this public?

Answered: 1 week ago

Question

How does or how might your organization affect this public?

Answered: 1 week ago