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
Fiesta28 [93]
4 years ago
4

Write the definition of a class Player containing:

Computers and Technology
1 answer:
marysya [2.9K]4 years ago
8 0

Answer:

The following program in c++  language:

#include <iostream>    //Header file

using namespace std; //using Nmaespace

class Player         //define a class "Player"

{

public:                // access modifier

string name = "";    // declare string type variable "name" and initialize non

int score = 0;         //  declare integer type variable "score" and initialize 0

void setName(string name1) //define a function "setName()" which has an argument

{

name = name1;

}  

void setScore (int score1)        // define a function "setScore()" which has one argument

{

score = score1;  

}  

string getName ()          // define a function "getName()" which shows output

{

return name;

}

int getScore ()      // define a function "getScore()"

{

return score; // returning the score

}

};

int main ()   //  main function

{

Player p1;          // create  a class object "p1"

p1.setName ("aaa"); // calling method setName

p1.setScore (150); // calling method setScore

cout <<"Name ="  <<p1.getName ()<<endl;

cout<<"score ="<<p1.getScore ()<<endl;

}

Output:

Name = aaa

score = 150

Explanation:

Firstly, we have defined a class named "Player" and then declare two variables first one is string type i.e, "name" which is initialize to null and second one is integer type i.e, "score" which is  initialize 0 then after that we have defined two functions first one is "setName()" and second one is "setScore()" for initializing the value after that we again declare two functions for returning the value of  "name" and "score" which is "getName()" and "getScore()".

finally  we call these method in a main() function.

You might be interested in
Which of the following processes is not part of the rock cycle?
Leviafan [203]
Igneous rock forced below the Earth's surface where it is turned into sedimentary rock through intense heat and pressure.

This process creates metamorphic rocks, not sedimentary.
3 0
4 years ago
Thinking about the operations needed in these games, which game is likely to be one of the oldest games in the world?
erma4kov [3.2K]
I would say tag because it only involves touching
6 0
3 years ago
Read 2 more answers
Explain the changing of work and enterprises due to the availability of EFTPOS?
kolbaska11 [484]
Who benefits from piracy?



5 0
3 years ago
____ storage is not recommended for long-term archiving because the storage media can degrade over time
Lunna [17]

Hard Drive is not recommended for long-term archiving because the storage media can degrade over time,

<h3>What type of storage is recommended for long term data retention?</h3>

The long method used to long-term retention is the use of cloud. Cloud-based are known to be a form of cold storage that is made up of intelligent storage software.

Note that Hard Drive is not a long term kind of storage in the above context and as such, PE storage is not recommended for long-term archiving because the storage media can degrade over time,

Learn more about storage from

brainly.com/question/1317328

#SPJ1

5 0
3 years ago
Python please!
riadik2000 [5.3K]

We have that the output that frequency with the next 4 higher key <u>frequencies  </u>is <em>mathematically </em>given as

Output

  • 120,127,13,134.8,142,1,151.19

From the question we are told

  • On a piano, a key has a frequency, say f0.
  • Each higher key (black or white) has a frequency of f0 * rn, where n is the distance (number of keys) from that key, and r is 2(1/12).
  • Given an initial key <em>frequency</em>, output that <em>frequency</em> and the next 4 higher key <em>frequencies</em>.

Output each floating-point value with two digits after the decimal point, which can be achieved as follows:

<h3> Output and frequency</h3>

Generally the code will go as follows

# The key frequency

f0 = float(input())

r = math.pow(2, (1 / 12))

# The frequency, the next 4 higher key f's.

frequency1 = f0 * math.pow(r, 0)

frequency2 = f0 * math.pow(r, 1)

frequency3 = f0 * math.pow(r, 2)

frequency4 = f0 * math.pow(r, 3)

frequency5 = f0 * math.pow(r, 4)

# printing output

print('{:.2f} {:.2f} {:.2f} {:.2f} {:.2f}'.format(frequency1, frequency2, frequency3, frequency4, frequency5))

Therefore

Output

120,127,13,134.8,142,1,151.19

For more information on frequency visit

brainly.com/question/22568180

3 0
3 years ago
Other questions:
  • A circuit has a resistance of 300 ohm and a current of 0.024 A. What is the voltage in the circuit?
    12·1 answer
  • What differences in traffic patterns account for the fact that STDM is a cost-effective form of multiplexing for a voice telepho
    10·1 answer
  • For each of the following data storage needs, describe which abstract data types you would suggest using. Natural choices would
    15·1 answer
  • _____ should be scanned for viruses
    13·2 answers
  • A Portable Document Format (PDF) can be opened with Adobe Acrobat Reader and many web browsers.
    14·1 answer
  • Determine the distance between point (x1, y1) and point (x2, y2), and assign the result to points Distance. The calculation is:
    14·1 answer
  • Hey guys I have a quick question about computer science I WILL MARK BRAINLIEST (crown )
    6·2 answers
  • What does XD mean? I keep seeing people say it and I dont know what it means
    6·2 answers
  • The software that requests mail delivery from the mail server to an Internet device is known as mail ____ software.
    6·1 answer
  • What are the two different types of dns requests?
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!