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
You recently created several new user accounts in the Sales OU and configured them with the appropriate group membership, logon
irga5000 [103]

Answer:

Disable the account until the employee is ready to use it.

Explanation:

6 0
2 years ago
These are code parts which can be collapsed or extended
skelet666 [1.2K]

Answer:

?????????? are there any options

3 0
2 years ago
An entrepreneur wants to make an app to show what breeds of dogs are similar to each other. She wants to look at factors such as
Alex

Answer

Dog breeds = observations, Average weight and energy level for each breed = variables. Each cluster is a category.

Explanation:

Using a method of clustering, she would be putting the dog breeds that are more similar together and in order to do this she has to look at various factors such as observation which are the dog breeds, and the average weight and energy level of the breeds, which represents variables. Every one of these clusters would be a category.

7 0
3 years ago
What is the best back-end language to be used with React Native for NFC, WiFi, and Bluetooth Mobile app.? I'm hasated between Py
Ugo [173]

Answer:

Node.js

Explanation:

since you're using react native(javascript), then working with node.js is more suitable. I prefer sticking around in the same language.

8 0
3 years ago
What summarizes a data source into a grid of rows and columns?
Ludmilka [50]
#1) What summarizes a data source into a grid of rows and columns?
Answer: A Database. A database is an organized collection of data. It is the collection of schemas, tables, queries, reports, views, and other objects. The data are typically organized to model aspects of reality in a way that supports processes requiring information.
4 0
3 years ago
Read 2 more answers
Other questions:
  • The set of communications rules for exchanging information electronically on the internet is called the ________.
    10·1 answer
  • A(n) _____ is a computer program that can damage files and programs on your computer.
    6·2 answers
  • In web developing, what are the differences between front-end developer, back-end developer and full stuck developer?
    8·1 answer
  • HOW TO FREE UP RAM/MEMORY ON YOUR DEVICE?
    12·2 answers
  • If there is only a stop sign posted at a railroad
    9·1 answer
  • Nearly all personal computers are capable of serving as network servers.
    10·2 answers
  • What was your first experience with listening to kpop?
    8·2 answers
  • How does computer number system play a Vital role in a computer calculation. ​
    8·1 answer
  • Programming in https<br>​
    5·1 answer
  • What is the maximum number of extended partitions can you have on a hard drive?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!