Question: c++ please create this class song (song.h file) and a song.cpp file It is very important that you write code that is separated in these
c++
please create this class song (song.h file) and a song.cpp file
It is very important that you write code that is separated in these files.
Here is the information about class song.
Class Song
You will also code your own Song class, so you can add Songs to your playlist. A Song stores the following information (private member variables):
std::string title_;
std::string author_;
std::string album_;
And the following operations (public member functions)
Song();
Song(const std::string& title, const std::string& author = "", const std::string& album = "");
void setTitle(std::string title); //"set" in setTitle here means "give a value" and has nothing
// to do with the Set class. Similarly for setAuthor and setAlbum
void setAuthor(std::string author);
void setAlbum(std::string album);
std::string getTitle() const;
std::string getAuthor() const;
std::string getAlbum() const;
friend bool operator==(const Song& lhs, const Song& rhs);
Make sure your code compiles and runs correctly with this main() function:
int main() {
//**********Test Song************//
//instantiate 5 songs
Song song1;
song1.setTitle("title 1");
song1.setAuthor("author 1");
song1.setAlbum("album 1");
Song song2("title 2", "author 2", "album 2");
Song song3("title 3", "author 3", "album 3");
Song song4("title 4", "author 4", "album 4");
Song song5("title 5", "author 5", "album 5");
//output song information
cout << "The first song is: " << song1.getTitle() << ", " << song1.getAuthor() << ", " << song1.getAlbum() << endl;
cout << "The second song is: " << song2.getTitle() << ", " << song2.getAuthor() << ", " << song2.getAlbum() << endl;
cout << "The third song is: " << song3.getTitle() << ", " << song3.getAuthor() << ", " << song3.getAlbum() << endl;
cout << "The fourth song is: " << song4.getTitle() << ", " << song4.getAuthor() << ", " << song4.getAlbum() << endl << endl;
}
thank you
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
