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

Create the C++ class represented by the Class Diagram shown below. Wire the \"ge

ID: 3556364 • Letter: C

Question

Create the C++ class represented by the Class Diagram shown below. Wire the "get" methods to the members with matching names. Overload the operators < and > so they compare the number of tickets sold in different world series.

BaseballWorldSeries

BaseballWorldSeries(std::string location, std::string winner, int ticketsSold);

std::string getWinner() const;

std::string getLocation() const;

friend bool operator < (const BaseballWorldSeries& bws1, const BaseballWorldSeries& bws2);

friend bool operator > (const BaseballWorldSeries& bws1, const BaseballWorldSeries& bws2);

string my_Location;

int my_NumberOfTicketsSold;

string my_Winner;

(Points : 20)

BaseballWorldSeries

BaseballWorldSeries(std::string location, std::string winner, int ticketsSold);

std::string getWinner() const;

std::string getLocation() const;

friend bool operator < (const BaseballWorldSeries& bws1, const BaseballWorldSeries& bws2);

friend bool operator > (const BaseballWorldSeries& bws1, const BaseballWorldSeries& bws2);

string my_Location;

int my_NumberOfTicketsSold;

string my_Winner;

Explanation / Answer

#include<iostream>
using namespace std;
class BaseballWorldSeries
{
string my_Location;
int my_NumberOfTicketsSold;
string my_Winner;
public:
BaseballWorldSeries(std::string location, std::string winner, int ticketsSold)
:my_Location(location),my_Winner(winner),
my_NumberOfTicketsSold(ticketsSold){};
std::string getWinner() const{
return my_Winner;};
std::string getLocation() const{
return my_Location;};
friend bool operator < (const BaseballWorldSeries& bws1, const BaseballWorldSeries& bws2)
{
return bws1.my_NumberOfTicketsSold<bws2.my_NumberOfTicketsSold;
};
friend bool operator > (const BaseballWorldSeries& bws1, const BaseballWorldSeries& bws2)
{
return bws1.my_NumberOfTicketsSold>bws2.my_NumberOfTicketsSold;
};
};

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote