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
What isthe concept of packets, give example?
Oduvanchick [21]

Answer: Packets are the small unit of data that is sent from source to destination on a network.

Explanation: Packets are small packages that carry data in a packet form and is used from transferring it on internet or any kind of packet-switched network. They use the internet protocol (IP) for the transmission of data.

Example: packet radio is a sort of digital radio that uses the packet for transmission of data to other nodes by utilizing the AX-25 protocol.

6 0
2 years ago
Nearly all social software systems include a(n) ________, which helps control your information flow.
Alekssandra [29.7K]

Answer:

dashboard

Explanation:

4 0
2 years ago
Read 2 more answers
One vital component of your professional behavior with regard to computing systems today is the creation of​ _________.
zlopas [31]
<span>One vital component of your professional behavior with regard to computing systems today is the creation of​ strong passwords.
It is very important to have a good password on your computer, especially if you are dealing with sensitive data and information. It would be for the best to create such a password which won't be hacked into easily, in case somebody wants to steal your data.
</span>
3 0
3 years ago
C++ a. Write a program that uses the function isPalindrome given in example 6-6 (Palindrome). Test your program on the followinn
Whitepunk [10]

Answer:

#include <iostream>

#include <array>

using namespace std;

bool isPalindrome(string str)  

{  

int length = str.length();  

for (int i = 0; i < length / 2; i++)  

 if (toupper(str[i]) != toupper(str[length - 1 - i]))

  return false;  

return true;  

}

int main()

{

array<string, 6> tests = { "madam", "abba", "22", "67876", "444244", "trymEuemYRT" };

for (auto test : tests) {

 cout << test << " is " << (isPalindrome(test) ? "" : "NOT ") << "a palindrome.\n";

}

}

Explanation:

The toupper() addition forces characters to uppercase, thereby making the comparison case insensitive.

5 0
3 years ago
A data visualization tool that updates in real time and gives multiple outputs is called
strojnjashka [21]

Answer:

A data dashboard

Explanation:

3 0
2 years ago
Other questions:
  • Which of the following is true of property?
    13·1 answer
  • Which of the following statements regarding EFT is false? EFT still requires the endorsement of a check EFT allows payment to be
    11·1 answer
  • The following pseudocode is an example of ____.do stepAdo stepBif conditionC is true thendo stepDelsedo stepEendifwhile conditio
    15·1 answer
  • __________ is a program that lets you share documents online with others.
    12·2 answers
  • Self-confidence, blank, and communication are key factors to building positive relationships. Fill in the blank with a 13 letter
    5·1 answer
  • Compare and contrast two fundamental security design principles in network security. Analyze how these principles and how they i
    15·1 answer
  • Is it true that if the user log out the computer will turn off automatically​
    9·2 answers
  • What is the best method to avoid getting spyware on a machine
    6·1 answer
  • in ____ structures, the computer repeats particular statements a certain number of times depending on some condition(s).
    5·2 answers
  • Why are pirated software considered a threat?​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!