1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
alisha [4.7K]
3 years ago
14

Write the interface (.h file) of a class ContestResult containing: An data member winner of type string, initialized to the empt

y string. An data member secondPlace of type string, initialized to the empty string. An data member thirdPlace of type string, initialized to the empty string. A member function called setWinner that has one parameter, whose value it assigns to the data member winner. A member function called setSecondPlace that has one parameter, whose value it assigns to the data member secondPlace. A member function called setThirdPlace that has one parameter, whose value it assigns to the data member thirdPlace. A member function called getWinner that has no parameters and that returns the value of the data member winner. A member function called getSecondPlace that has no parameters and that returns the value of the data member secondPlace. A member function called getThirdPlace that has no parameters and that returns the value of the data member thirdPlace.
Computers and Technology
1 answer:
egoroff_w [7]3 years ago
5 0

Answer:

#include <string>

using namespace std;

class ContestResult{

private:

string winner;

string secondPlace;

string thirdPlace;

public:

// default constructor to initialize with empty string

ContestResult();

void setWinner(string);

void setSecondPlace(string);

void setThirdPlace(string);

string getWinner();

string getSecondPlace();

string getThirdPlace();

};

#################### ContestResult.cpp ###################

#include <string>

#include "ContestResult.h"

using namespace std;

ContestResult::ContestResult(){

winner = "";

secondPlace = "";

thirdPlace = "";

}

void ContestResult::setWinner(string theWinner){

winner= theWinner;

}

void ContestResult::setSecondPlace(string theSecondPlace){

secondPlace= theSecondPlace;

}

void ContestResult::setThirdPlace(string theThirdPlace){

thirdPlace= theThirdPlace;

}

string ContestResult::getWinner(){

return winner;

}

string ContestResult::getSecondPlace(){

return secondPlace;

}

string ContestResult::getThirdPlace(){

return thirdPlace;

}

#################### ContestResultTest.cpp ###################

#include <string>

#include <iostream>

#include "ContestResult.h"

using namespace std;

int main(){

// creating object of ContestResult

ContestResult c;

// settinf all members

c.setWinner("The Legend");

c.setSecondPlace("Pravesh");

c.setThirdPlace("Alex");

cout<<"Winner: "<<c.getWinner()<<endl;

cout<<"Second Place: "<<c.getSecondPlace()<<endl;

cout<<"Third Place: "<<c.getThirdPlace()<<endl;

return 0;

}

Explanation:

See answer

You might be interested in
A disadvantage of ethernet??
Blababa [14]
Ethernet is a wired internet connection. So, one obvious draw back is you can only go so far as your Ethernet cable will allow you.
3 0
3 years ago
Http://www.alegrium.com/sgi/2/eibder
Flura [38]

Answer:

so what is this uhhhhhhhhhh

7 0
2 years ago
Engineers at Edison Laboratories developed a _____ strip that allowed them to capture sequences of images on film.
maxonik [38]

Answer:

Kinetoscope

Explanation:

4 0
2 years ago
Read 2 more answers
A program written in a(n) procedural language consists of sequences of statements that manipulate data items. __________________
Alenkasestr [34]

Answer:

true.

Explanation:

According to my research on information technology, I can say that based on the information provided within the question the statement is completely true. Procedural programming is a widely used paradigm that basically gives the program a set of routines or specifications, and the program mixes and matches them as they continuously repeat the process. It is used in many areas, including video game development.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

7 0
3 years ago
Let's revisit our lucky_number function. We want to change it, so that instead of printing the message, it returns the message.
maksim [4K]

Answer:

Replace the first blank with:

message = "Hello " + name + ". Your lucky number is " + str(number)

Replace the second blank with:

return message

Explanation:

The first blank needs to be filled with a variable; we can make use of any variable name as long as it follows the variable naming convention.

Having said that, I decided to make use of variable name "message", without the quotes

The next blank is meant to return the variable on the previous line;

Since the variable that was used is message, the next blank will be "return message", without the quotes

3 0
3 years ago
Other questions:
  • Face book requires you to change your password regularly<br> a. TRUE<br> b. FALSE
    14·1 answer
  • ECG mashine is an example of
    12·1 answer
  • The purpose of the 3030 gas dehydration unit
    11·1 answer
  • PLEASE HELP, Answer Correctly..Will give a bunch of brainlist points ​
    10·1 answer
  • Find different between manocots and dicots clarify with example​
    14·1 answer
  • Type the correct answer in the box. Spell all words correctly.
    7·2 answers
  • When all the system testing and bugs correction has done, the software product will be delivered to the user for __________.
    15·1 answer
  • Write a multi-way if statement that compares the double variable pH with 7.0 and makes the following assignments to the bool var
    11·1 answer
  • The Table Design and Layout tabs are available under the
    13·2 answers
  • URGENT HELPP<br> WILL MARK BRAINLIST
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!