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
Lemur [1.5K]
3 years ago
7

Write a full class definition for a class named Player , and containing the following members:

Computers and Technology
1 answer:
Paraphin [41]3 years ago
6 0

Answer:

I used C++ to implement this program using dev c++, however, i defined the public method inside the class. The code with illustration of this question is given in section phase. If you want to define the classes outside from class then you can use scope resolution operator to access the method of the class. However, the complete running code is given below in <em>explanation </em>section

Explanation:

#include <iostream>// included preprocessor directive

using namespace std;

class player// class player is started from here

{

private:// class varaibles are set at here and scope of varialbe is private.

 string name;//variable for getting and setting name of player

 int score;//variable for getting and setting score of player

 

public:// declaring public method that can be accessbile outside of class but in this program

 void setName (string name)// public method for setting name of player

{

 this->name=name;// name is initialized by paramenter name to variable name

}

 void setScore(int score)//publice method for setting score of player

{

 this->score=score;

}

int getScore()// public method for getting score of player

{

 return score;// on call, return the score of player

}

string getName()// public method for getting name of player

{

 return name;// return player name;

}

 

};//end of class "player"

int main()//main function get executed

{

   player firstPlayer;//class object "firstPlayer" is created

firstPlayer.setName("Renaldo");// firstPlayer name is initialized

firstPlayer.setScore(500);// assgined score to firstPlayer

string getname=firstPlayer.getName();// get name of firstPlayer

int getscore=firstPlayer.getScore();//get score of firstPlayer

cout<<getname;//print name of firstPlayer

cout<<"\n";//line break

cout<<getscore;//print score of firstPlayer

cout<<"\n";//line break

   

   return 0;//end of program

}

You might be interested in
Scott does not use privacy settings on his social media account. He includes all his contact details on his profile and posts lo
tia_tia [17]

Answer:

A. B. D.

Explanation:

Idrk just sayin

6 0
3 years ago
Read 2 more answers
What are three good things and three bad things about the metal pewter
Setler79 [48]
Good things:
It is a solid material,NOT plated which makes it easily engravable.
does not tarnish or
discolor easily

Bad things:
It is not a high quality metal
It will melt at low temperatures,so do not get it around extreme heat.
It can damage easy if exposed to acids like lemon juice or vinager


4 0
4 years ago
HURRY
Irina-Kira [14]

<em>Your answer is B: cooperative player-to-player interaction</em>

<em></em>

<em></em>

<em />

6 0
4 years ago
Debugging is not testing, but always occurs as a consequence of testing. <br> A) TRUE<br> B) FALSE
kherson [118]
A) True Hope that helps
5 0
4 years ago
The Fibonacci numbers are a sequence of integers in which the first two elements are 1, and each following element is the sum of
ioda

Answer:

// program in java to print 12 fibonacci terms

// package

import java.util.*;

// class definition

class Main

{

   // main method of the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

     

      // variables

      int no_of_term=12, f_term = 1, s_term = 1, n_term = 0;

      System.out.print("First 12 term of Fibonacci Series:");

      // print 12 terms of the Series

       for (int x = 1; x<= no_of_term; x++)

           {

       // Prints the first two terms.

            if(x <=2 )

            System.out.print(1+" ");

            else

            {

               // find the next term

                n_term = f_term + s_term;

                // update the last two terms

                f_term = s_term;

                s_term = n_term;

                // print the next term

              System.out.print(n_term+" ");

            }

           }

     

     

   }catch(Exception ex){

       return;}

}

}

Explanation:

Declare and initialize no_of_term=12,f_term=1,s_term=1 and n_term=0.Run a loop  for 12 times, for first term print 1 and then next term will be calculated as  sum of previous two term of Series.Then update previous two term.This will  continue for 12 time and print the terms of Fibonacci Series.

Output:

First 12 term of Fibonacci Series:1 1 2 3 5 8 13 21 34 55 89 144

4 0
3 years ago
Other questions:
  • A(n) ________ network is a computer network that spans a relatively small area, allowing all computer users to connect with each
    14·1 answer
  • If you touch a downed power line covered or bare, what’s the likely outcome?
    10·2 answers
  • 1. What should you do if your computer is shared by your entire family and you install a plugin that saves user names and passwo
    5·2 answers
  • Gina is upgrading your computer with a new processor. She installs the processor into your motherboard and adds the cooling syst
    13·2 answers
  • _____ are networks that learn and are capable of performing tasks that are difficult with conventional computers.
    11·1 answer
  • To move to the beginning of the line with the keyboard, press the _______ key(s).
    6·1 answer
  • What is the exclusive legal right granted to all authors and artists that gives them sole ownership of their work to print, publ
    5·2 answers
  • OSI layer for HDLC??​
    13·1 answer
  • Which attributes does not come in tag?
    12·2 answers
  • A major way the National Information Infrastructure Protection Act of 1996 amended the Computer Fraud and Abuse Act was the subs
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!