Questions
C++ question. Need all cpp and header files. Part 1 - Polymorphism problem 3-1 You are...

C++ question. Need all cpp and header files.

Part 1 - Polymorphism

problem 3-1

You are going to build a C++ program which runs a single game of Rock, Paper, Scissors. Two players (a human player and a computer player) will compete and individually choose Rock, Paper, or Scissors. They will then simultaneously declare their choices and the winner is determined by comparing the players’ choices. Rock beats Scissors. Scissors beats Paper. Paper beats Rock.

The learning objectives of this task is to help develop your understanding of abstract classes, inheritance, and polymorphism.

Your task is to produce a set of classes that will allow a human player to type instructions from the keyboard and interact with a computer player.

Your submission needs to contain the following files, along with their header files:

  • main-3-1.cpp
  • Player.cpp
  • Person.cpp
  • Computer.cpp

Part 1: Abstract Classes
Define and implement an abstract class named Player that has the following behaviours:

void move();
string getMoves();
char getMove(); //returns the most recent move made
bool win(Player * opponent); //compares players’ moves to see who wins

Declare the move() and getMoves() functions as pure virtual and set proper access modifiers for the attributes and methods.

If no one wins, the game should output “draw! go again”, and the game continues until a winner is determined.

Part 2: Polymorphism

Computer Class:

Define and implement a class named Computer that inherits from Player. By default, Computer will use Rock for every turn. If it is constructed with another value (Paper or Scissors), it will instead make that move every turn.

The Computer class has the following constructor and behaviours:

Computer(string letter); //set what move the computer will
//make (rock, paper, or scissors)
//if the input is not r, R, p, P, s, S or
//a string starting with one of these letters,
//set the move to the default ‘r’

string getMoves(); //returns all moves stored in a string

void move(); //increments number of moves made

To explain, if the computer was constructed with Computer(‘s’), and it made 3 moves, getMoves() should return:

sss
For advice about testing, please use the debugging manual (Links to an external site.).

Person Class:

Define and implement a class named Person that inherits from Player. The Person can choose Rock, Paper, or Scissors based on the user’s input.

The Player class has the following behaviours:

void move(); //allow user to type in a single character to
//represent their move. If a move is impossible,
//“Move unavailable” is outputted and the user is
//asked to input a character again.
//Otherwise, their input is stored

string getMoves();   //returns all moves stored in a string

Write a main function that uses Computer and Person to play Rock, Paper, Scissors. The Computer can be made with either constructors, but should set the default move to ‘r’. The player should be asked to input a move which is then compared against the computer’s move to determine who wins.

All the Player’s previous moves should be outputted, followed by all the Computer’s moves outputted on a new line.

In: Computer Science

Interpreting stock quotes Assume that the following quote for the Walt Disney Company, a NYSE stock,...

Interpreting stock quotes

Assume that the following quote for the Walt Disney Company, a NYSE stock, appeared on May 1, 2015 (Friday) on Yahoo! Finance ( http://finance.yahoo.com/q?s=DIS&ql=1):

The Walt Disney Company (DIS) - NYSE

110.52 ↑ 1.80(1.66%) 4:01PM EDT

Prev Close: 108.72 Day's Range: 109.27 - 110.67
Open: 109.79 52wk Range: 78.54 - 111.66
Bid: 110.81 x 400 Volume: 6,205,116
Ask: 110.95 x 500 Avg Vol (3m): 6,394,880
1y Target Est: 110.23 Market Cap: 187.84B
Beta: 1.1 P/E (ttm) 24.57
Next Earnings Date: 5-May-15 EPS (ttm): 4.50
Div & Yield: 1.15 (1.10%)


Given this information, answer the following questions.

  1. At what price did the stock sell at the time of the quote?
    $ _________
  2. What is the stock's price/earnings ratio?
    ___________
    What does that indicate? Round your answers to the nearest whole number.
    This means that investors are willing to pay more than $ _________ for every $1 of earnings per share that the company generated last year.
  3. What is the last price at which the stock traded on the prior trading day?
    $ ______________
  4. What's the stock's dividend yield?
    __________%
  5. What are the highest and lowest prices at which the stock traded during the latest 52-week period?
    Highest price $  
    Lowest price $  
  6. How large is the market capitalization of the company?
    $ __________ billion

In: Finance

Define the characteristics of a probability measure, and explain the difference between a theoretical probability distribution and an empirical probability distribution (a priori vs. a posteriori).

 

  1. Define the characteristics of a probability measure, and explain the difference between a theoretical probability distribution and an empirical probability distribution (a priori vs. a posteriori). (1 point)
  2. Describe the characteristics of a normal distribution. (1 point)
  3. Explain the importance of the central limit theorem. (1 point)

In: Statistics and Probability

Problem 13-09 (Algorithmic) Myrtle Air Express decided to offer direct service from Cleveland to Myrtle Beach....

Problem 13-09 (Algorithmic)

Myrtle Air Express decided to offer direct service from Cleveland to Myrtle Beach. Management must decide between a full-price service using the company’s new fleet of jet aircraft and a discount service using smaller capacity commuter planes. It is clear that the best choice depends on the market reaction to the service Myrtle Air offers. Management developed estimates of the contribution to profit for each type of service based upon two possible levels of demand for service to Myrtle Beach: strong and weak. The following table shows the estimated quarterly profits (in thousands of dollars):

Demand for Service
Service Strong Weak
Full price $1500 -$530
Discount $1030 $500
  1. What is the decision to be made, what is the chance event, and what is the consequence for this problem?

    The input in the box below will not be graded, but may be reviewed and considered by your instructor.



    How many decision alternatives are there?

    Number of decision alternatives =

    How many outcomes are there for the chance event?

    Number of outcomes =
  2. If nothing is known about the probabilities of the chance outcomes, what is the recommended decision using the optimistic, conservative and minimax regret approaches?
    Optimistic approach
    Conservative approach
    Minimax regret approach
  3. Suppose that management of Myrtle Air Express believes that the probability of strong demand is 0.7 and the probability of weak demand is 0.3. Use the expected value approach to determine an optimal decision.

    Optimal Decision :
  4. Suppose that the probability of strong demand is 0.8 and the probability of weak demand is 0.2. What is the optimal decision using the expected value approach?

    Optimal Decision :
  5. Use graphical sensitivity analysis to determine the range of demand probabilities for which each of the decision alternatives has the largest expected value. If required, round your answer to four decimal places.

    is the best choice if probability of strong demand is less than or equal to .

In: Statistics and Probability

The parking superintendent is responsible for snow removal at his parking garage. The probabilities for the...

The parking superintendent is responsible for snow removal at his parking garage. The probabilities for the number of days per year requiring snow removal are shown in the chart below. These probabilities are independent from year to year. The superintendent can contract for snow removal at a cost of $500 per day. Alternatively, he can purchase a snow-removal machine for $40,000. It is expected to have a useful life of 10 years and no salvage value at that time. Annual costs for operating and maintaining the machine are estimated to be $14,000. MARR is 10 percent per year. For the following questions, determine an analytical solution: a. Determine the mean and standard deviation of the present worth of the savings resulting from purchasing the snow-removal machine. b. Assuming the present worth is normally distributed, what is the probability of a positive present worth of the savings resulting from purchasing the machine? For the following questions, determine a simulation solution using @RISK: Parameter Pessimistic Most Likely Optimistic Initial Cost $10,500,000 $8,875,000 $6,000,000 Annual Operating $350,000 $175,000 $150,000 Annual Revenue $1,500,000 $2,500,000 $3,500,000 Number of Days Per Year Probability 20-0.15

40-0.15

60-0.35

80-0.30

100-0.05

For the following questions, determine an analytical solution:

a. Determine the mean and standard deviation of the present worth of the savings resulting from purchasing the snow-removal machine.

b. Assuming the present worth is normally distributed, what is the probability of a positive present worth of the savings resulting from purchasing the machine? For the following questions, determine a simulation solution using @RISK:
c.Using a Latin hypercube simulation with 10,000 iterations, estimate the mean and standard deviation of present worth and the probability of positive present worth.

d. Using a Monte Carlo simulation with 10,000 iterations, estimate the mean and standard deviation of present worth and the probability of positive present worth.

In: Economics

Problem 13-09 (Algorithmic) Myrtle Air Express decided to offer direct service from Cleveland to Myrtle Beach....

Problem 13-09 (Algorithmic)

Myrtle Air Express decided to offer direct service from Cleveland to Myrtle Beach. Management must decide between a full-price service using the company’s new fleet of jet aircraft and a discount service using smaller capacity commuter planes. It is clear that the best choice depends on the market reaction to the service Myrtle Air offers. Management developed estimates of the contribution to profit for each type of service based upon two possible levels of demand for service to Myrtle Beach: strong and weak. The following table shows the estimated quarterly profits (in thousands of dollars):

Demand for Service
Service Strong Weak
Full price $1320 -$550
Discount $980 $440
  1. What is the decision to be made, what is the chance event, and what is the consequence for this problem?

    The input in the box below will not be graded, but may be reviewed and considered by your instructor.



    How many decision alternatives are there?

    Number of decision alternatives =

    How many outcomes are there for the chance event?

    Number of outcomes =
  2. If nothing is known about the probabilities of the chance outcomes, what is the recommended decision using the optimistic, conservative and minimax regret approaches?
    Optimistic approach
    Conservative approach
    Minimax regret approach
  3. Suppose that management of Myrtle Air Express believes that the probability of strong demand is 0.7 and the probability of weak demand is 0.3. Use the expected value approach to determine an optimal decision.

    Optimal Decision :  
  4. Suppose that the probability of strong demand is 0.8 and the probability of weak demand is 0.2. What is the optimal decision using the expected value approach?

    Optimal Decision :  
  5. Determine the range of demand probabilities for which each of the decision alternatives has the largest expected value. If required, round your answer to four decimal places.

      is the best choice if probability of strong demand is less than or equal to . For values of  greater than , the full price service is   choice.

In: Operations Management

Murphy’s Law: The Air Force has ordered a new fighter jet from Lockheed Martin with contains...

Murphy’s Law: The Air Force has ordered a new fighter jet from Lockheed Martin with contains 1000 critical engineering components. Tests have shown that each of these parts will fail independently with a probability of p = 0.001. In the design team they have to decide how much redundancy to build into the system. (a) Define a random variable X which counts the number of components which fail on the jet. What distribution does X have, and what are the parameters of the distribution? (b) If they add no redundancy into the system, so that the jet will fail if ANY of these 100 critical components fails what is the probability that the jet fails? (c) Given these numbers they decide to add some redundancy so that the jet will continue to work as long as less than k components fail. What is the minimum k where the probability for the jet to fail is less than P(X > k) < 0.001

In: Statistics and Probability

Let x be the number of courses for which a randomly selected student at a certain...

Let x be the number of courses for which a randomly selected student at a certain university is registered. The probability distribution of x appears in the table shown below:

x 1 2 3 4 5 6 7

p(x) .05 .03 .09 .26 .37 .16 .04

(a) What is P(x = 4)? P(x = 4) =

(b) What is P(x 4)? P(x 4) =

(c) What is the probability that the selected student is taking at most five courses? P(at most 5 courses) =

(d) What is the probability that the selected student is taking at least five courses?

more than five courses?

P(at least 5 courses) =

P(more than 5 courses) =

(e) Calculate P(3 x 6) and P(3 < x < 6). P(3 x 6) = P(3 < x < 6) =

In: Statistics and Probability

Numerical example of screening for breast cancer Let’s work with some numbers in connection with extensive...

Numerical example of screening for breast cancer

Let’s work with some numbers in connection with extensive and intensive margin using the screening example mentioned in the book. Let’s assume that p, probability of detecting true cases, is 0.9; q, probability of a false positive, is 0.05; f, probability of true positives in the population, is 0.2.

  1. Consider the initial population of 1,000, what is the yield (total number of detection)?
  2. Now, suppose that we extend the screening to a new population of 1,000 woman with younger age, whose f is only 0.1 (less of them would have breast cancer). Calculate the additional yield. What is the extensive margin?
  3. Go back to case a) with the original population, suppose now we can increase p to 0.95 by screening women more frequently, at a price of a higher q of 0.1. What is total yield now? What is the intensive margin?

In: Statistics and Probability

Numerical example of screening for breast cancer Let’s work with some numbers in connection with extensive...

Numerical example of screening for breast cancer

Let’s work with some numbers in connection with extensive and intensive margin using the screening example mentioned in the book. Let’s assume that p, probability of detecting true cases, is 0.9; q, probability of a false positive, is 0.05; f, probability of true positives in the population, is 0.2.

  1. Consider the initial population of 1,000, what is the yield (total number of detection)?
  2. Now, suppose that we extend the screening to a new population of 1,000 woman with younger age, whose f is only 0.1 (less of them would have breast cancer). Calculate the additional yield. What is the extensive margin?
  3. Go back to case a) with the original population, suppose now we can increase p to 0.95 by screening women more frequently, at a price of a higher q of 0.1. What is total yield now? What is the intensive margin?

In: Statistics and Probability