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
Renee's creating a plan for her business's information system. What should she do after she determines the goals for her busines
Sever21 [200]
The correct answer is letter D, determine how applying information systems will increase her business opportunities. 

This is the smartest and the best step that she can take in order for her to increase her profits from her business. When here profits have increased, it is already easy to figure out the next steps on how she can expand her company. 
5 0
3 years ago
Describe your WGU program, including two specific requirements that this degree has for completion.
Pavlova-9 [17]

Answer:

WGU program, including two specific requirements that this degree has for completion is explained below in details.

Explanation:

WGU is an online academy with profession joined bachelor's and master's degrees in—IT, education, marketing, and healthcare—intended to support working professionals fit an online academy learning into their hard-working lives.

As a scholars, graduate pupils must register in at least eight competency units every term, and undergraduate pupils must register in at least twelve competency units respectively term.

3 0
3 years ago
Write an application that displays the strings in the provided array alphabetically in ascending order.
mr Goodwill [35]

Answer:

Explanation:

The following code is written in Python and it is a very simple function/program that takes in an array of strings as a parameter called names. This array is then passed the built-in sort function which automatically sorts it in ascending alphabetical order. Finally, the print method is called on the names array to print all of its elements out.

def sort_strings(names):

   names.sort()

   print(names)

8 0
3 years ago
In every organization, workers receive and sendinformation daily. The flow of this information should be____________.upward and
Aleks [24]

Answer:

upward and downward

Explanation:

4 0
3 years ago
Which type of error is a random error
zlopas [31]

Answer:

statistical fluctuations

Explanation:

8 0
3 years ago
Read 2 more answers
Other questions:
  • How long can a lightning last
    13·1 answer
  • The purpose of the ________ element is used to configure the main content of a web page document.
    5·1 answer
  • To insert a new slide in an existing presentation, what menu should you select?
    5·2 answers
  • Which is the correct sequence of steps for opening a new document?
    10·2 answers
  • A beginning driver may tend to oversteer. This means the driver what? Btw Cars are technology so that is why it is under Compute
    11·1 answer
  • If data from a DOS system is electronically sent to an EHR or other Windows-based system via an interface to populate an indexed
    7·1 answer
  • The _device provides a means of communication between a computer and outer world.​
    14·1 answer
  • Use the dropdown menus to complete the sentences about Live Preview and the Mini Toolbar Live Preview is a convenient way to see
    15·2 answers
  • The advancement of technology in our daily lives has changed how we interact with the world.
    10·1 answer
  • A message is sent to all hosts on a remote network. Which type of message is it?.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!