Question
Please write the code according to the information below, don't copy anyone else's code for this assignment because they are all incorrect, I will not
Please write the code according to the information below, don't copy anyone else's code for this assignment because they are all incorrect, I will not upvote if the code is copied from someone else, everything is given below.
The Document Files with Code and input are below in a URL form:
file:///D:/Donloads/main.pdf
file:///D:/Donloads/Song.h.pdf
file:///D:/Donloads/Song.cpp.pdf
file:///D:/Donloads/Output.txt
file:///D:/Donloads/OutputDouble.txt
file:///D:/Donloads/SongsData.txt
file:///D:/Donloads/SongsDataDouble.txt
#include
#include
class Song {
private:
std::string title;
std::string singer;
int chartPosition;
public:
// default constructor
Song() {}
// custom constructor
Song(std::string title, std::string singer, int chartPosition) {
this->title = title;
this->singer = singer;
this->chartPosition = chartPosition;
}
// getter and setter for title
std::string getTitle() {
return this->title;
}
void setTitle(std::string title) {
this->title = title;
}
// getter and setter for singer
std::string getSinger() {
return this->singer;
}
void setSinger(std::string singer) {
this->singer = singer;
}
// getter and setter for chart position
int getChartPosition() {
return this->chartPosition;
}
void setChartPosition(int chartPosition) {
this->chartPosition = chartPosition;
}
// returns object as a string
std::string toString() {
return this->title + " by " + this->singer + " at position " + std::to_string(this->chartPosition);
}
// overloads the
bool operator
return this->chartPosition
}
// overloads the
friend std::ostream & operator
os
return os;
}
};
\# Write a class called Song in a file called Song.h with three fields: Title (string) Singer (string) Chart Position (int) \# Place these method headers in the Song. h file 1. Getter and setter for each field 2. Other methods 1. Song(); // default constructor 2. Song(std::string title,std:: string singer, int chartPosition); I/ custom constructor 3. std::string toString(); // returns object as a string 4. bool operatorStep 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