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.

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

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;

}

};

//Song.h

#ifndef SONG_H

#define SONG_H

#include

class Song

{

private:

std::string title;

std::string singer;

int chartPosition;

public:

//GIVEN CODE

Song();

Song(std::string title, std::string singer, int chartPosition);

//TODO: create getter and setter functions for each field

//TODO: create other methods

std::string toString();

bool operator

friend std::ostream & operator

};

#endif // SONG_H

//Song.cpp

#include "Song.h"

//GIVEN CODE

Song::Song()

{

title = "";

singer = "";

chartPosition = 0;

}

//GIVEN CODE

Song::Song(std::string title, std::string singer, int chartPosition)

{

this->title = title;

this->singer = singer;

this->chartPosition = chartPosition;

}

//TODO: create getter and setter functions for each field

std::string Song::getTitle()

{

return title;

}

void Song::setTitle(std::string title)

{

this->title = title;

}

std::string Song::getSinger()

{

return singer;

}

void Song::setSinger(std::string singer)

{

this->singer = singer;

}

int Song::getChartPosition()

{

return chartPosition;

}

void Song::setChartPosition(int chartPosition)

{

this->chartPosition = chartPosition;

}

//TODO: create other methods

std::string Song::toString()

{

return title + " by " + singer + " at " + std::to_string(chartPosition);

}

bool Song::operator

{

return chartPosition

}

std::ostream & operator

{

os toString();

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 operator

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!