answer.
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]
2 years ago
4

Write the definition of a class Player containing:

Computers and Technology
1 answer:
marysya [2.9K]2 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
Compare the memory organization schemes of contiguous memory allocation and paging with respect to the following issues: a. Exte
Free_Kalibri [48]

Answer:

The comparison is based on memory organization schemes of contiguous memory allocation and paging with respect to External fragmentation, Internal fragmentation and Ability to share code across processes.

Explanation:

Memory organization schemes of contiguous memory allocation:

Contiguous memory allocation schemes suffers from external fragmentation. The reason is that address space is distributed contiguously and the holes and gaps keep growing when the old processes die and new processes are introduced. The variable size partition suffers from external fragmentation however the fixed size partitions do not suffer from external fragmentation. Contiguous memory allocation with variable size partitions does not encounter an internal fragmentation but with fixed size partitions suffers from internal fragmentation. Contiguous memory allocation does not support sharing code across processes. This is because the virtual memory segment of a process is not fragmented into non-contiguous fine grained blocks.

Paging:

Paging does not encounter external fragmentation as pages are of the fixed or equal size. So this reduces external fragmentation. However paging suffers from internal fragmentation. This is because a process can request more space or it can request for a less space. When page is allocated to the such a process that page is no longer utilized.This results in internal fragmentation because of the wastage of space even when the page has internal space but cannot be fully utilized. Paging allows to share code across processes.

5 0
2 years ago
One factor affecting digital camera quality is the number of pixels, measured in ____, used to store the data for each image.
Vlada [557]
One factor affecting digital camera quality is the number of pixels, measured in megapixels, use to store the data for each image.
5 0
2 years ago
Read 2 more answers
When you connect to an unsecured wireless network, what might dishonest or unscrupulous computer users try to do?
loris [4]

Answer:

Hackers can snoop on data sent over your network.

Hackers can use your network to access your computer's files and system information.

Explanation: Unsecured Wireless connections are wireless connections which are have no passwords they are open to the general public,such networks can be very risky to use as it gives easy access to dishonest persons who can manipulate that opportunity to SNOOP ON DATA SENT OVER YOUR NETWORKS. They can use this hacking to fraudulently steal from your bank account and obtain your private information.

8 0
2 years ago
Write a for loop that prints the odd integers 11 through 121 inclusive, separated by spaces.
mixas84 [53]
The code for the above problem is:
<span>/* package whatever; // don't place package name! */ 

import java.util.*;
import java.lang.*;
import java.io.*; 

/* Name of the class has to be "Main" only if the class is public. */

class Ideone{ public static void main (String[] args) throws java.lang.Exception 
{ 
 for(int i=11; i<=121; i=i+2){
   System.out.print(i); System.out.print(" "); 
 } 
}<span>}

I hope this is the answer that you were looking for. </span></span>
4 0
2 years ago
Restore points are created at regular intervals and just before you install software or hardware by what utility?
AlexFokin [52]

Answer:

a

Explanation:

System restoration and it is a tool to return the status of the system to a selected point previously created by the user or by the machine after installing a software or an important event.

3 0
2 years ago
Other questions:
  • You want to implement a mechanism that automates ip configuration, including ip address, subnet mask, default gateway, and dns i
    14·1 answer
  • Which of the following is true about protected access?
    7·1 answer
  • Assignment 1 is to write a program that will write the lyrics to "X number of beers on the wall". Use only the main method. Prom
    11·1 answer
  • Tina reported a safety hazard at her workplace to OSHA. Representatives from OSHA
    5·1 answer
  • Given three dictionaries, associated with the variables, canadian_capitals, mexican_capitals, and us_capitals, that map province
    11·1 answer
  • Suppose a computer using direct mapped cache has 220 bytes of byte-addressable main memory, and a cache of 32 blocks, where each
    5·1 answer
  • In the lab, you discovered that the server you scanned (10.20.1.2) was vulnerable to the WannaCry ransomeware attack. What ports
    15·1 answer
  • . Electricians will sometimes call ______ "disconnects" or a "disconnecting means."
    12·1 answer
  • What does NOT match with Agile Manifesto?
    9·1 answer
  • In this problem, you will derive the efficiency of a CSMA/CD-like multiple access protocol. In this protocol, time is slotted an
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!