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
There are 22 gloves in a drawer: 5 pairs of red gloves, 4 pairs of yellow, and 2 pairs of green. You select the gloves in the da
AVprozaik [17]

Answer:

Best-case = 2 gloves

Worst-case = 12 gloves

Explanation:

  • For the best-case: Because there is a chance that you take two gloves of the same color in the first two round the answer is two.
  • For the worst-case: The worst case would be if, for each color-group of gloves you take the right or left glove, for example, you take 5 left-hand red gloves then 4 left-hand yellow gloves, then 2 left-hand green gloves, because you have already taken all of the left gloves the next one is going to be a right glove that is going to pair with one of the already selected gloves, therefore, the answer is 12 -> 5+4+2+1 = 12
3 0
2 years ago
(1) Prompt the user for an automobile service. Output the user's input. (1 pt) Ex: Enter desired auto service: Oil change You en
Pavlova-9 [17]

Answer:

In Python:

#1

service = input("Enter desired auto service: ")

print("You entered: "+service)

#2

if service.lower() == "oil change":

   print("Cost of oil change: $35")

elif service.lower() == "car wash":

   print("Cost of car wash: $7")

elif service.lower() == "tire rotation":

   print("Cost of tire rotation: $19")

else:

   print("Invalid Service")

Explanation:

First, we prompt the user for the auto service

service = input("Enter desired auto service: ")

Next, we print the service entered

print("You entered: "+service)

Next, we check if the service entered is available (irrespective of the sentence case used for input). If yes, the cost of the service is printed.

This is achieved using the following if conditions

For Oil Change

<em>if service.lower() == "oil change":</em>

<em>    print("Cost of oil change: $35")</em>

For Car wash

<em>elif service.lower() == "car wash":</em>

<em>    print("Cost of car wash: $7")</em>

For Tire rotation

<em>elif service.lower() == "tire rotation":</em>

<em>    print("Cost of tire rotation: $19")</em>

Any service different from the above three, is invalid

<em>else:</em>

<em>    print("Invalid Service")</em>

<em></em>

6 0
2 years ago
You receive an offer for a credit card that can be use to accrue points that
Jlenok [28]

Answer: (C) A special service for current customers

Explanation:

  The CRM is the customer relationship management that typically use by the banks for providing special type of services to the current customer. This is the way to attract various types of users or customers by providing some special type of offers.

According to the question, bank provide the credit card offers to the customer on the airline tickets so, it is beneficial for both the customer and for the bank as well.

3 0
3 years ago
Select the correct answer.
goblinko [34]

Answer:

b

Explanation:

8 0
2 years ago
Write a program to prepare the monthly charge account statement for a customer of CS CARD International, a credit card company.
WITCHER [35]

Answer:

import java.util.*;

import java.text.*;

class CreditCardBill

{

public static void main(String[] args)

{

Scanner sc = new Scanner(System.in);

NumberFormat defaultFormat = NumberFormat.getCurrencyInstance(Locale.US);

System.out.println("CS Card International Statement");

System.out.println("===============================");

System.out.print("Previous Balance: $");

double prevBalance = sc.nextDouble();

System.out.print("Additional Charges: $");

double addCharges = sc.nextDouble();

double interest;

if(prevBalance == 0)

interest = 0;

else

interest = (prevBalance + addCharges) * 0.02;

System.out.println("Interest: "+defaultFormat.format(interest));

double newBalance = prevBalance + addCharges + interest;

System.out.println("New Balance: "+defaultFormat.format(newBalance));

double minPayment;

if(newBalance < 50)

minPayment = newBalance;

else if(newBalance <= 300)

minPayment = 50.00;

else

minPayment = newBalance * 0.2;

System.out.println("Minimum Payment: "+defaultFormat.format(minPayment));

}

}

5 0
2 years ago
Other questions:
  • Which graphic design tool allows you to lay images on top of one another? A. Layers B. Selection C. Drawing D. Color
    10·2 answers
  • 80% OF QUESTIONS ARE ANSWERED IN UNDER 10 MINUTES why not mine
    15·2 answers
  • What are some situations where you might find it useful to use the “!” symbol in a program?
    9·1 answer
  • Which type of interview is conducted in a format where the interviewee is questioned and presented to a panel of individuals?
    7·2 answers
  • Name a piece of software you often use where it is easy to produce an error. Explain ways you could improve the interface to bet
    5·1 answer
  • Extend to also calculate and output the number of 1 gallon cans needed to paint the wal. Hint: Use a math function to round up t
    12·1 answer
  • Emma lives in Pennsylvania, what climate does she live in?
    7·1 answer
  • Your job is to choose a data structure to implement polynomials whose coefficients are positive integers, such as 17x^4+4x^3+0x^
    9·1 answer
  • Mention and explain various alignment options​
    9·1 answer
  • Pls need this asap
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!