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
tresset_1 [31]
3 years ago
7

Write the interface (.h file) of a class Player containing: A data member name of type string. A data member score of type int.A

member function called setName that accepts a parameter and assigns it to name . The function returns no value.
A member function called setScore that accepts a parameter and assigns it to score . The function returns no value.
A member function called getName that accepts no parameters and returns the value of name .
A member function called getScore that accepts no parameters and returns the value of score .
My start code:
class Player
{
string name;
int score;
void setScore (int playerScore)
{
score = playerScore;
}
int getScore()
{
return score;
}
}
Computers and Technology
1 answer:
mezya [45]3 years ago
7 0

Answer:

Following are the class definition to this question:

class Player//defining a Player class  

{

private://use access specifier

string name;//defining string variable  

int score;//defining integer variabl  

public://use access specifier

void setName(string par_name);//declaring the setName method with one string parameter

void setScore(int par_score);//declaring the setScore method with one integer parameter

string getName();//declaring string method getName

int getScore();//declaring integer method getScore

};

Explanation:

In the above-given code, a Player class is defined, that hold a method and the variable which can be defined as follows:

  • It uses two access specifier, that are public and private.
  • In private, a string and an integer variable "name, score" is declared, which holds their respective value.
  • In public, it declares the get and set method, which holds the value from its parameters.
You might be interested in
HELP ASAP!! Ohms law homework
kvv77 [185]

4a)

According to Ohm's law (Current) = (Voltage)/(Resistance)

Given the values: (Current) = 9V / 470 Ohm = 19.1 mA

The current through the LED is 19.1mA, or 0.019A

4b)

(max current) = (voltage)/(min resistance) =>

(min resistance) = (voltage)/(max current) = 6V / 0.05 A = 120 Ohm

The resistor must be at least 120 Ohm, otherwise the LED will fry.

8 0
3 years ago
Which is the most efficient way to make the text in a row bold in every worksheet in the file?
son4ous [18]
The answer is D hope it's right
5 0
3 years ago
Read 2 more answers
Multiple Choice
Maurinko [17]

Answer:

dont do more then you handle

8 0
3 years ago
Students at a university are working on a project. the project involves many computing systems working together on disjointed ta
skad [1K]
I think that the form of computing the project would be using is CLUSTER COMPUTING.

It involves a group of linked computers working together that it forms, in essence, a single computer. In this way, each user can work on his or her own tasks all at the same time. This will improve performance, increase output, and it is more cost-effective than using a single computer for the whole project.
8 0
4 years ago
Read 2 more answers
What is instant messaging
SpyIntel [72]
Instant messaging (IM) is a type of communication where one person can send a message (typically text based) and have another (1 or more) recipient receive the message.
6 0
3 years ago
Other questions:
  • #Imagine you're writing a program to check if a person is
    8·1 answer
  • Explain the nature of documents that can be suitable for mergin
    12·1 answer
  • Mai has recently created her own e-mail account. Her father gave her permission to e-mail her friends and family but warned her
    11·2 answers
  • When troubleshooting a desktop motherboard, you discover the network port no longer works. What is the best and least expensive
    12·1 answer
  • A copy of the copyrighted work must be exactly the same as the original to infringe a copyright.
    9·1 answer
  • Secure Multipurpose Internet Mail Extensions builds on the encoding format of the MIME protocol and uses digital signatures base
    15·1 answer
  • Within the information category of functions, you will find functions that ____.
    7·2 answers
  • Your boss wants you to set up an authentication scheme in which employees will use smart cards to log in to the company network.
    15·1 answer
  • The Many–Hands Problem makes it difficult to determine who should be held accountable for mistakes since:
    7·1 answer
  • When proposing a plan in detail for video production phases, fundraising, and outreaching, which section will you use to make su
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!