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:
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, 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.
| Highest price | $ |
| Lowest price | $ |
In: Finance
In: Statistics and Probability
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 |
| Optimistic approach | |
| Conservative approach | |
| Minimax regret approach |
In: Statistics and Probability
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. 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 |
| Optimistic approach | |
| Conservative approach | |
| Minimax regret approach |
In: Operations Management
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 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 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.
In: Statistics and Probability
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.
In: Statistics and Probability