Paragraph

To complete and enhance MusicLibrary class and Song class. Please refer to Lab three document for more information about the classes.

In our vision of the Digital Music Library, it is a collection of songs. There- fore, we have a Song class, as an abstraction of song, and also a MusicLibrary class for keeping track and organizing songs. We could imagine that others could use the two classes that we will develop to build interesting applications just as we have used string and vector classes as well as standard library functions to build interesting programs.

Purpose

Understand class, member function and field, constructor, operator overloading as member functions or basic functions. Understand file input and output. Learn and know how to use vector, which may be viewed as our first example of a template class and a container class.

Design

In MusicLibrary class design, both add and remove methods require us to com- pare if two songs contain identical information. It seems that the code would be more readable if we could use ”==” operator on two songs to determine if they contain identical information. In general, we could use == to compare two objects of the basic type, but it uses bitwise comparison and will not work for us (try to construct two songs using the default constructor and compare the two with ==). To solve this problem, we will add an operator == to the Song class to determine if two songs contain the same information. Song class code.

In lab three, << is overloaded for us, so we can use it to output an object of Song as fields separated by comma. We will add the overloading of >> as another utility, where a correct comma delimited sequence of fields (in the right order) is read into a song. Stream operator overload and usage

Use the improved Song class as well as the overloaded << and >> to complete other member functions of MusicLibrary class: the other constructor MusicLibrary(string filename, string owner); the other remove method bool remove(Song s); the save method bool save() const; and to simplify the implementation of other member functions done in the lab if it is possible. Music library function prototypes.

Implementation

Use the same source file structure as in Lab three.

Test and evaluation

Add more code to the main program to fully test the newly implemented member functions.

Report and documentation

A short report about things observed and things learned and understood. The report should also describe the test cases used in the main program and the reasons for each test case selected. Properly document and indent the source code. The source code must include the author name and as well as a synopsis of the file.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.