Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ ----- Song.h is given please help me with Song.cpp Class Song You will code

ID: 3744358 • Letter: C

Question

C++ ----- Song.h is given please help me with Song.cpp

Class Song

You will 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);

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);

Explanation / Answer

#include #include "Song.h" using namespace std; Song::Song() { } Song::Song(const std::string& title, const std::string& author, const std::string& album) { title_ = title; author_ = author; album_ = album; } void Song::setTitle(std::string title) { title_ = title; } void Song::setAuthor(std::string author) { author_ = author; } void Song::setAlbum(std::string album) { album_ = album; } std::string Song::getTitle() const { return title_; } std::string Song::getAuthor() const { return author_; } std::string Song::getAlbum() const { return album_; } bool operator==(const Song& lhs, const Song& rhs) { return lhs.getTitle() == rhs.getTitle() && lhs.getAuthor() == rhs.getAuthor() && lhs.getAlbum() == lhs.getAlbum(); }