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
Write a loop that continually asks the user what pets the user has until the user enters stop, in which case the loop ends. It s
Nataliya [291]

Answer:

int counter = 0;
String userInput = "";
while (userInput != "stop") {
print "What pet do you have? ";
userInput = readInputLine();
if (userInput != "stop" ){
counter = counter + 1;
print "\nYou have one ";
print userInput;
print ". Total # of Pets: ";
print counter;
}
}

Explanation:

not sure what programming language you use, therefore the answer is pseudocode but it should give you an idea how to implement a piece of code for this problem.
Also, from the way you described the exercise I'm not sure if you always are supposed to reply with "you have one" + the pet or if you should count how often the same pet was entered.

6 0
1 year ago
List the seven basic internal components found in a computer tower
Softa [21]
The basic internal components found in a computer tower also called as computer case are the following:

1. The motherboard
2. The power supply
3. Hard drives
4. Fan
5. Random Access Memory - RAM
6. CD - Rom's and DVD - Rom's
7. Ports and Hubs

These are found inside your PC case.

6 0
3 years ago
Question 16 of 40
neonofarm [45]

Answer:

D hjjhhhhhhhhhhhhhhh

Explanation:

cuz

6 0
3 years ago
Read 2 more answers
Don't click on this I am testing
Andrew [12]

Don't click on this I am testing... I want the points so.

3 0
3 years ago
Read 2 more answers
How would you "break" a firewall in a laptop computer if you were no longer a administrator? (Cyber Security Related, Computers
4vir4ik [10]
Okay so what you would is press ctrl+alt+delete and click log out i think but if you have a disk put it in and secure everything trust me i am a computer savage. i hack thing all the time.

6 0
3 years ago
Other questions:
  • an object or device outside the computer, that one would plug into a port to control the functions of a computer are?
    9·2 answers
  • If the Account Number field in a record always should display the three characters in the account number in uppercase, then the
    14·1 answer
  • Which turn best describe news one is connected to the government and is used as a political tool more than as a business product
    12·1 answer
  • A laptop gets recycled by an e-waste recycling company once it can't be used anymore. Which stage of the hardware lifecycle does
    7·1 answer
  • Which page in a web site do viewers usually see first?
    15·1 answer
  • The HTTP protocol operates at which layer?
    7·1 answer
  • Group of programs are software <br>​
    11·1 answer
  • 72. In Object Oriented Programming, a class_____ starts
    12·1 answer
  • How to transfer word 2019 from one computer to another
    12·1 answer
  • PLEASE HELP! WILL MARK AS BRAINLIEST!
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!