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
barxatty [35]
2 years ago
11

Write the implementation (.cpp file) of the Player class from the previous exercise. Again, the class contains:

Engineering
1 answer:
hoa [83]2 years ago
7 0

Answer:

//Define the header file

#ifndef PLAYER_H

#define PLAYER_H

//header file.

#include <string>

//Use the standard namespace.

using namespace std;

//Define the class Player.

class Player

{

//Declare the required data members.

string name;

int score;

public:

//Declare the required

//member functions.

void setName(string par_name);

void setScore(int par_score);

string getName();

int getScore();    

}

//End the definition

//of the header file.

#endif

Player.cpp:

//Include the "Player.h" header file,

#include "Player.h"

//Define the setName() function.

void Player::setName(string par_name)

{

name = par_name;

}

//Define the setScore() function.

void Player::setScore(int par_score)

{

score = par_score;

}

//Define the getName() function.

string Player::getName()

{

return name;

}

//Define the getScore() function.

int Player::getScore()

{

return score;

}

You might be interested in
A curve in a speed track has a radius of 1000 ft and a rated speed of 120 mi/h. (From Sample Prob. 12.7 is the definition of rat
forsale [732]

Answer:

tan \theta = \frac{(176ft/s)^2}{1000 ft 32.2 ft/s^2}= 0.962

\theta = tan^{-1} (0.962) = 43.89

Explanation:

If the question is: Determine the banking angle θ

We have the forces involved on the figure attached.

For this case we know that the weight is given by:

W = mg

And for this case the centripetal acceleration would be given by:

a=\frac{v^2}{r}

If we analyze the sum of forces on x and y we have:

\sum F_x = m a_x

F + W sin \theta = ma cos theta

And if we solve for the force we got:

F = ma cos \theta - mg sin \theta = \frac{mv^2}{r} cos \theta - mg sin \theta

\sum F_y = m a_y

N - W cos \theta = ma sin \theta

If we solve for the normal force we got:

N =W cos \theta + ma sin \theta = \frac{mv^2}{r} sin \theta + mg cos \theta

In order to find the banking angle we use the fact that F =0

0 = \frac{mv^2}{r} cos \theta - mg sin \theta

tan \theta= \frac{v^2}{rg}

The velocity on this case is 120 mi/h if we convert this into ft/ s we got:

120 mi/h * \frac{5280 ft}{1mi} *\frac{1hr}{3600 s}= 176 ft/s

And then we have this:

tan \theta = \frac{(176ft/s)^2}{1000 ft 32.2 ft/s^2}= 0.962

\theta = tan^{-1} (0.962) = 43.89

5 0
2 years ago
A system consisting of 3 lb of water vapor in a piston–cylinder assembly, initially at 350°F and a volume of 71.7 ft3, is expand
Alla [95]

Answer:

isobaric expansion = 281.09 Btu

isothermal compression= 72 Btu

Explanation:

The first law of thermodynamics is:

Q_{AB}=W_{AB}+deltaU_{AB}

where:

Q=heat transferred

W= work

U=internal energy  

W_{AB}=P*(V_{B}-V_{A})

U_{AB}=n*C_{v}(T_{2}-T_{1})

P=pressure, V= volume, T= temperature, n =  moles, Cv= specific heat at constant volume.

In a isobaric process heat transferred is:

Q=P*(V_{B}-V_{A})+n*C_{v}(T_{2}-T_{1})

For an isothermal process (T2-T1 = 0) so

Q=P*(V_{B}-V_{A})= W_{AB}

From the data we know that the energy transferred to the system in the isothermal compression by work was 72 Btu that is the heat transferred to the system.

For the first process

Q=P*(V_{B}-V_{A})+n*C_{v}(T_{2}-T_{1})

we have to properties at the beginning of the process : temperature (350°F) and specific volume (V/mass)

specific-volume=\frac{71.7 ft^{3}}{3Lb}=23.9\frac{ft^{3}}{Lb}

we use this information in the appropriate unit to find the pressure in thermodynamic tables.

T1= 176°C

v1= 1.49 m^3/kg

P=1.37 bar

in the second state we have

P=1.37 bar =137000Pa

v_{2}=\frac{85.38ft^{3}}{3Lb}= 28.46\frac{ft^{3}}{Lb}

with thee properties we check in the thermodynamic tables

T2= 255°C

n=mass/Mw = 3Lb*\frac {1kg}{2.2Lb}*\frac{1000gr}{1kg}*\frac{1mol}{18gr}=75.75 mol

we usually find Cp on tables for water but from the Mayer relation we have:

C_{v}=C_{p}+R

Cp for water vapor is: 33.12 J/mol*K

R=8.314 J/mol*K

Cv= 41.434 J/mol*K

replacing in the equation for Q

Q=137000 Pa*(2.41m^{3}-2.030m^{3})+75.75mol*41.434\frac{ J}{mol*K}*(528.15-449.81 K)=296569J

296569J =281.09 Btu

5 0
2 years ago
Poles are values of Laplace transform variable, s, that make denominator of transfer function zero. Zeros are values of Laplace
Ostrovityanka [42]

Answer:

Zero 1 = -1

Zero 2 = -3

Pole 1 = 0

Pole 2 = -2

Pole 3 = -4

Pole 4 = -6

Gain = 4

Explanation:

For any given transfer function, the general form is given as

T.F = k [N(s)] ÷ [D(s)]

where k = gain of the transfer function

N(s) is the numerator polynomial of the transfer function whose roots are the zeros of the transfer function.

D(s) is the denominator polynomial of the transfer function whose roots are the poles of the transfer function.

k [N(s)] = 4s² + 16s + 12 = 4[s² + 4s + 3]

it is evident that

Gain = k = 4

N(s) = (s² + 4s + 3) = (s² + s + 3s + 3)

= s(s + 1) + 3 (s + 1) = (s + 1)(s + 3)

The zeros are -1 and -3

D(s) = s⁴ + 12s³ + 44s² + 48s

= s(s³ + 12s² + 44s + 48)

= s(s + 2)(s + 4)(s + 6)

The roots are then, 0, -2, -4 and -6.

Hope this Helps!!!

3 0
2 years ago
Raul doesn’t feel like he needs to write down events that will happen months from now. Explain to him why it is important to use
MAXImum [283]
The primary reason for having a calendar is to organize the days, weeks, months and years. It keeps a track of which day of the week events fall and when special events are going to happen. Historically speaking calendars were often uses to preserve religious holidays and events.
4 0
2 years ago
Read 2 more answers
Same rule: If both players spend the same number of coins, player 2 gains 1 coin. Off-by-one rule: If the players do not spend t
Galina-37 [17]

Answer:

Check the explanation

Explanation:

1 -

public int getPlayer2Move(int round)

{

  int result = 0;

 

  //If round is divided by 3

  if(round%3 == 0) {

      result= 3;

  }

  //if round is not divided by 3 and is divided by 2

  else if(round%3 != 0 && round%2 == 0) {

      result = 2;

  }

  //if round is not divided by 3 or 2

  else {

      result = 1;

  }

 

  return result;

}

2-

public void playGame()

{

 

  //Initializing player 1 coins

  int player1Coins = startingCoins;

 

  //Initializing player 2 coins

  int player2Coins = startingCoins;

 

 

  for ( int round = 1 ; round <= maxRounds ; round++) {

     

      //if the player 1 or player 2 coins are less than 3

      if(player1Coins < 3 || player2Coins < 3) {

          break;

      }

     

      //The number of coins player 1 spends

      int player1Spends = getPlayer1Move();

     

      //The number of coins player 2 spends

      int player2Spends = getPlayer2Move(round);

     

      //Remaining coins of player 1

      player1Coins -= player1Spends;

     

      //Remaining coins of player 2

      player2Coins -= player2Spends;

     

      //If player 2 spends the same number of coins as player 2 spends

      if ( player1Spends == player2Spends) {

          player2Coins += 1;

          continue;

      }

     

      //positive difference between the number of coins spent by the two players

      int difference = Math.abs(player1Spends - player2Spends) ;

     

      //if difference is 1

      if( difference == 1) {

          player2Coins += 1;

          continue;

      }

     

      //If difference is 2

      if(difference == 2) {

          player1Coins += 2;

          continue;

      }

     

     

  }

 

  // At the end of the game

  //If player 1 coins is equal to player two coins

  if(player1Coins == player2Coins) {

      System.out.println("tie game");

  }

  //If player 1 coins are greater than player 2 coins

  else if(player1Coins > player2Coins) {

      System.out.println("player 1 wins");

  }

  //If player 2 coins is grater than player 2 coins

  else if(player1Coins < player2Coins) {

      System.out.println("player 2 wins");

  }

}

3 0
2 years ago
Other questions:
  • How much extra water does a 21.5 ft, 175-lb concrete canoe displace compared to an ultra-lightweight 38-lb Kevlar canoe of the s
    8·1 answer
  • Gina is about to use a fire extinguisher on a small fire. What factor determines the type of extinguisher she should use
    9·2 answers
  • Which of the following is correct regarding the principal stresses and maximum in-plane shear stresses? a. Principal stresses ca
    14·1 answer
  • Your assignment is to write a menu driven program. The menu will be responded to using a switch statement. The menu options (cas
    6·1 answer
  • An uninsulated, thin-walled pipe of 100-mm diameter is used to transport water to equipment that operates outdoors and uses the
    9·1 answer
  • With thermodynamics, one cannot determine ________.
    14·1 answer
  • 1. A spur gear made of bronze drives a mid steel pinion with angular velocity ratio of 13 /2 : 1. Thepressure angle is 14 1/2° .
    12·1 answer
  • A heat recovery device involves transferring energy from the hot flue gases passing through an annular region to pressurized wat
    6·1 answer
  • When comparing solids to fluids, the following is true: for elastic solids, the stress must be normal. For Newtonian fluids, the
    9·1 answer
  • Lydia is the CEO for a large pharmaceutical manufacturer. Her company is in the final stages of FDA
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!