Use the provided BingoBall.h and Set.h files to implement the Set.cpp file.
//File: BingoBall.h
#ifndef BINGOBALL_H
#define BINGOBALL_H
#include <iostream>
class BingoBall {
public:
BingoBall():letter{'a'}, number{0} {}
BingoBall(char let, int num) :
letter{ let }, number{ num }
{}
char getChar() const { return letter; }
int getNumber() const { return number; }
//overload == operator
bool operator==(BingoBall &b) const { return
(number == b.getNumber() && letter == b.getChar()); }
private:
char letter;
int number;
};
inline std::ostream& operator<<(std::ostream& out,
const BingoBall& b) {
out << b.getChar() << "-" <<
b.getNumber();
return out;
}
#endif /* BINGOBALL_H */
// File: Set.h
#ifndef SET_H
#define SET_H
#include <string>
using namespace std;
template <typename T>
class Set{
public:
//creates an initially empy set
Set();
//destroys the set, deallocating any freed memory
space if appropriate
~Set();
//adds the element to the set (if it is not already
in there)
//returns false if element is not in universe, true
otherwise
bool addElement(const T& elem);
//removes the specified element from set and
returns the removed element, returns
//nullpointer if the element was not in the
set
T removeElement(const T& elem);
//removes a random element and returns it, returns
nullpointer if the set was empty initially
T removeRandom();
//returns true if the given element is in the set,
false otherwise
bool isIn(const T& elem) const;
//returns true if the set is empty, false
otherwise
bool empty() const;
//returns number of elements in the set
int size() const;
private:
//class level variable for holding an array based set
implementation
T* setArray;
//the number of elements in the set
int numEntries;
//used for array based implementations to hold the
maximum size of
//the array (do we need this? why or why not?)
int arraySize;
};
// displays the entire set, solely for debugging purposes
template <typename T>
std::ostream& operator<<(std::ostream& out,
Set<T>& p);
#endif /* SET_H */
In: Computer Science
Many games involve the use of dice. The singular form of dice is die. A standard die is a cube, i.e. a polyhedron with six sides. Each side of a die has a number of dots (or pips) on it; each side of a die is unique and contains a number of pips from 1 through 6. A die is rolled or tossed such that it comes to rest with one side randomly facing up. The die is said to have rolled a number equal to the number of pips on the side facing up.
Armed with this knowledge:
Part 1 (20%)
Implement a Java class called Die with the following features:
Part 2 (30%)
Implement a dice game called Guess wherein the player chooses a number between 2 and 12 - this is the range of possible values that can be achieved by summing the result of rolling a pair of dice. This dice game will be in its own class called Guess; it will not be in the Die class.
The game then creates two die objects and rolls them together up to three times. If the player's number comes up when summing the result of rolling the pair of dice, the player wins and the game ends. If, after three rolls of the pair of dice, the player's number has not come up, the computer wins and the game ends.
Create output charting the progress of the game and the result.
Part 3 (50%)
Implement a dice game called Matador. The Matador game will be in its own class called Matador; it will not be in the Die class or in the Guess class.
Here are the rules of Matador:
The first to reach a total score of 121 wins. Create output charting the progress of the game and the result.
Please submit:
In: Computer Science
A fair red die and a fair green die are rolled.
(a) What is the probability that the sum of the numbers is even?
(b) What is the probability that the number on the red die is more than the number on the green die?
(c) What is the probability that the number on the red die is twice the number on the green die?
(d) What is the probability that the number on the red die is different from the number on the green die?
In: Statistics and Probability
Scenario: Film producer, Jack Magnet, is evaluating a script for a potential film. Based on that script, Magnet has initially estimated the probability of the film being a hit at 0.05, average at 0.1, and the probability of it being a flop 0.85. The studio accounting department estimates that if it is a hit, the film will make $320 million in profit, with an average take profits are estimated to be $90 million, and if a flop, will lose $50 million.
Prior to deciding whether or not to produce a film, Magnet can to decide whether or not to hire a prominent film critic to review and evaluate the script. A large number of critic’s previous reviews/assessments are available, as well as the final outcome of the associated productions. Using this information, we can calculate that, given a positive review, the probability of a hit would increase to 0.12, the probability of average would be 0.18 and of a flop 0.7. If the critic issues a negative review, the probability of a hit drops to 0.03, the probability of average drops to 0.06, with flop increasing to 0.91. In addition, the probability of a positive review has been determined to be 0.25 and a negative review 0.75. The cost for the critic’s review is $100,000.
In: Economics
Supplier 1; X=1.500 inches
σx=0.003 inches
Supplier 2; X=1.500 inches
σx=0.0022 inches
Supplier 3; X=1.4950 inches
σx=0.0015 inches
Which supplier would you purchase from, why? Explain your logic and show calculations and graphical evidence to back it up.
In: Statistics and Probability
Please show neat solution that is readable. Thanks!
1. A refrigerator has a cooling liquid. Describe the stages and how energy is added or released at each stage in relationship to the 2nd law of thermodynamics.
2. You are familiar with the laws of thermodynamics in form and description. Relate any one to the process of an air-conditioning unit in a house
3. A vertical hydraulic cylinder has a piston with a diameter of 23mm, if the ambient pressure is 70 kPa, determine the mass (N) of the piston if the internal pressure is 0.3MPa.
4. Air flows through a pipe of 60cm diameter with a velocity of 0.7 m/s. If the specific volume of the air is 0.1 m3/kg determine:
The flow (m3/s)
Mass flow (kg/s)
5. Pressure in a piston system is at 120 kPa and a volume of 0.5m3 if the volume is increased to 0.75m3 what is the new pressure?
6. A volume of 0.25 m3 at a temperature of 1250C and pressure at 80kPa has the temperature increased by 200K. What is the new volume?
7. Explain the chemistry that occurs when a fuel is burnt and relate to all the laws of Thermodynamics.
In: Physics
Geoff is running a carnival game. He has 15 marbles in a bag: there are 4 green marbles, 7 red marbles and 4 yellow marbles. To play a round of the game, a player randomly takes out 2 marbles (without replacement) from the bag. Green marbles win 5 points, red marbles win 1 point and yellow marbles lose 2 points.
Let X be the random variable that describes the number of points won by a player playing a single round of Geoff's marble game. Find the probability distribution for X. Give values for X as whole numbers and probabilities as decimal values to 3 decimal places. Enter the values for X in ascending order (lowest to highest) from left to right in the table.
| X | ||||||
| P(X=x) |
In: Math
In: Physics
Two fair dice are rolled:
a) What is the probability of an even number or a 3 on the first die? Are these two events mutually exclusive and why?
b) What is the probability of an even number on the first die and a 5 on the second? Is conditional probability involved in this case? Why or why not?
In: Statistics and Probability
Use a normal approximation to find the probability of the indicated number of voters. In this case, assume that 187 eligible voters aged 18-24 are randomly selected. Suppose a previous study showed that among eligible voters aged 18-24, 22% of them voted.
Probability that exactly 46 voted
The probability that exactly 46 of 187 eligible voters voted is
______
(Round to four decimal places as needed.)
In: Statistics and Probability