Questions
PLEASE USE PYTHON THANK YOU In the game of Lucky Sevens, the player rolls a pair...

PLEASE USE PYTHON THANK YOU

In the game of Lucky Sevens, the player rolls a pair of dice. If the dots add up to 7, the player wins $4; otherwise, the player loses $1. Suppose that, to entice the gullible, a casino tells players that there are many ways to win: (1, 6), (2, 5), and soon. A little mathematical analysis reveals that there are not enough ways to win to make the game worthwhile; however, because many people's eyes glaze over at the first mention of mathematics “wins $4”.

      Your challenge is to write a program that demonstrates the futility of playing the game. Your Python program should take as input the amount of money that the player wants to put into the pot, and play the game until the pot is empty.

          The program should have at least TWO functions (Input validation and Sum of the dots of user’s two dice). Like the program 1, your code should be user-friendly and able to handle all possible user input. The game should be able to allow a user to ply as many times as she/he wants.

          The program should print a table as following:

      Number of rolls             Win or Loss                Current value of the pot

                  0                                 Put                                   $10

                  1                                 Win                                  $14

                  2                                 Loss                                  $13

                  3                                 Loss                                  $12

                  ##                              Loss                                  $0

        You lost your money after ## rolls of play.

        The maximum amount of money in the pot during the playing is $##.

        Do you want to play again?

      At that point the player’s pot is empty (the Current value of the pot is zero), the program should display the number of rolls it took to break the player and the maximum amount of money in the pot during the playing.

        Again, add good comments to your program.

        Test your program with $5, $10 and $20.

In the game of Lucky Sevens, the player rolls a pair of dice. If the dots add up to 7, the player wins $4; otherwise, the player loses $1. Suppose that, to entice the gullible, a casino tells players that there are many ways to win: (1, 6), (2, 5), and soon. A little mathematical analysis reveals that there are not enough ways to win to make the game worthwhile; however, because many people's eyes glaze over at the first mention of mathematics “wins $4”.

      Your challenge is to write a program that demonstrates the futility of playing the game. Your Python program should take as input the amount of money that the player wants to put into the pot, and play the game until the pot is empty.

          The program should have at least TWO functions (Input validation and Sum of the dots of user’s two dice). Like the program 1, your code should be user-friendly and able to handle all possible user input. The game should be able to allow a user to ply as many times as she/he wants.

          The program should print a table as following:

      Number of rolls             Win or Loss                Current value of the pot

                  0                                 Put                                   $10

                  1                                 Win                                  $14

                  2                                 Loss                                  $13

                  3                                 Loss                                  $12

                  ##                              Loss                                  $0

        You lost your money after ## rolls of play.

        The maximum amount of money in the pot during the playing is $##.

        Do you want to play again?

      At that point the player’s pot is empty (the Current value of the pot is zero), the program should display the number of rolls it took to break the player and the maximum amount of money in the pot during the playing.

        Again, add good comments to your program.

        Test your program with $5, $10 and $20.

In: Computer Science

ROCK, PAPER, SCISSORS Using C++, you will implement a class called Tool. It should have an...

ROCK, PAPER, SCISSORS

Using C++, you will implement a class called Tool. It should have an int field called strength and a char field called type. You may make them either private or protected. The Tool class should also contain the function void setStrength(int), which sets the strength for the Tool.
Create 3 more classes called Rock, Paper, and Scissors, which inherit from Tool. Each of these classes will need a default constructor that sets the strength to 1 and a non-default constructor which will take in an int used to initialize the strength field. The constructor should also initialize the type field using 'r' for Rock, 'p' for Paper, and 's' for Scissors.
These classes will also need a public function bool fight(Tool) that compares their strengths in the following way:
 Rock's strength is doubled (temporarily) when fighting scissors, but halved (temporarily) when fighting paper.
 In the same way, paper has the advantage against rock, and scissors against paper.
 The strength field shouldn't change in the function, which returns true if the original class wins in strength and false otherwise.
**A design choice that returns a type other than a bool for a win, loss, or tie will not be penalized**
You may also include any extra auxiliary functions and/or fields in any of these classes.
In addition, you will create a class called RPSGame, which allows a human to play the rock, paper, scissors game against the computer. Your RPSGame must have two Tool * for the human and computer tool because you don’t know the new tool they’ll select with each round. The RPSGame should also have three int fields to keep track of the number of human_wins, computer_wins, and ties.
You can choose the strategy for the computer guesses, but it cannot be based on what the human selected for a tool in the current game!!! Example of a novice and veteran computer AI: http://www.nytimes.com/interactive/science/rock-paper-scissors.html?_r=0
After the human selects the tool for the current game, display the computer’s tool, a message describing who won, the current stats for the wins and ties, and then ask the user if he/she wants to play again.
Example Play of Game:
Welcome to Rock, Paper, Scissors! Do you want to choose different strengths for the tools? (y-yes, n-no) n
Choose your tool (r-rock, p-paper, s-scissor, e-exit): r
Computer chose scissor.
You win!!!
Human wins: 1
Computer wins: 0
Ties: 0
Choose your tool (r-rock, p-paper, s-scissor, e-exit): r
Computer chose paper.
Computer wins! :-(
Human wins: 1
Computer wins: 1
Ties: 0
Choose your tool (r-rock, p-paper, s-scissor, e-exit): e
Things to consider:
If you choose to set different strengths for the tools, then you need to prompt the user for his/her specific strength for their tool, and you will need to select a specific strength for the AI choice.
**If you selected one non-default strength for both, then you will not be penalized**
You must have the proper constructors, destructors, and assignment operator overload for the Tool, Rock, Paper, Scissor, and RPSGame classes.
Your member variables in all classes must be private or protected for encapsulation rules.
You must have your class definitions in a .h file and your implemented classes in .cpp files.
You must also have your main function in a play_game.cpp file, separated from the class implementations.​

In: Computer Science

JAVA PROGRAM Without changing changing main or PlayOneGame, you need to write the rest of the...

JAVA PROGRAM

Without changing changing main or PlayOneGame, you need to write the rest of the methods. Please complete "Rock, Scissor, Paper" game.

Main:

public static void main(String[] args )
{
   int wins = 0;
   int losses = 0;
   PrintWelcomeMessage();            // Just says hello and explains the rules
   while( PlayerWantsToPlay() )      // Asks the player if they want to play, and returns true or false
   {
      boolean outcome = PlayOneGame();  // One full game.  We do NOT come back here on a tie.  The game is not over on a tie.  
      if( outcome == true )
         wins++;
      else
         losses++;
   }
   PrintGoodByeMessage( wins, losses ); // Prints the outcome of the games
}

Playonegame:

static boolean PlayOneGame()
{
   int AI; int player; int outcome;
   do
   {
      AI = AIPick(); // 0,1,2
      player = PlayerPick() // 0,1,2
      outcome = ComputeWinner(AI, Player)// 0,1,2
   } while( outcome == 0 );// while tied

   if( outcome == 1 )
      return true; // they won
   else
      return false;// they lost
}

In: Computer Science

1. In another problem, I had four movies D, C, S and R and a preference...

1. In another problem, I had four movies D, C, S and R and a preference ordering for three people who were voting on which one to go see. Let’s use this one instead:

person 1: D R C S

person 2: S R D C

person 3: C S D R

(a) Suppose the voting method was to choose between the pairs D, C versus S, R, and then choose between whichever pair wins. Who would win?

(b) Suppose instead they started with a choice between D,S versus C,R. Who would win?

(c) Suppose they started the third way, a choice between D, R and C, S. Who would win?

(d) When we make these predictions about who would win, are we assuming that the players know each others’ preferences, or are we assuming only that they know their own?

(e) Which movie would they go to if they used the Borda count method? (There might be ties, of course. Then they’d flip a coin or roll dice among the highest scorers.)

In: Economics

Each time a modem transmits one bit, the receiving modem analyzes the signal arrives and decides...

Each time a modem transmits one bit, the receiving modem analyzes the signal arrives and decides whether the transmitted bit is 0 or 1. It makes an error with probability p, independent of whether any other bit is received correctly. a) If the transmission continues until first error, what is the distribution of random variable X, the number of bits transmitted? b) If p = 0.1, what is probability that X = 10? c) what is probability that X > 5? d) If modem transmits 30bits, what is the distribution of random variable Y, the number of error? e) If p = 0.15, what is probability that Y< 3, f) if the transmission continues until third error ,what is the distribution of random variable Z,    the number of bits transmitted?   g) If p = 0.2, what is probability that Z = 5? h) what is probability that Z > 5 ?

In: Statistics and Probability

3. Each time a modem transmits one bit, the receiving modem analyzes the signal arrives and...

3. Each time a modem transmits one bit, the receiving modem analyzes the signal arrives and decides whether the transmitted bit is 0 or 1. It makes an error with probability p, independent of whether any other bit is received correctly. a) If the transmission continues until first error, what is the distribution of random variable X, the number of bits transmitted? b) If p = 0.1, what is probability that X = 10? c) what is probability that X > 5? d) If modem transmits 30bits, what is the distribution of random variable Y, the number of error? e) If p = 0.15, what is probability that Y< 3, f) if the transmission continues until third error ,what is the distribution of random variable Z, the number of bits transmitted? g) If p = 0.2, what is probability that Z = 5? h) what is probability that Z > 5

In: Statistics and Probability

3. Each time a modem transmits one bit, the receiving modem analyzes the signal arrives and...

3. Each time a modem transmits one bit, the receiving modem analyzes the signal arrives and decides whether the transmitted bit is 0 or 1. It makes an error with probability p, independent of whether any other bit is received correctly.

a) If the transmission continues until first error, what is the distribution of random variable X, the number of bits transmitted?

b) If p = 0.1, what is probability that X = 10?

c) what is probability that X > 5?

d) If modem transmits 30bits, what is the distribution of random variable Y, the number of error?

e) If p = 0.15, what is probability that Y< 3,

f) if the transmission continues until third error ,what is the distribution of random variable Z, the number of bits transmitted?

g) If p = 0.2, what is probability that Z = 5?

h) what is probability that Z > 5?

In: Statistics and Probability

Consider a sample of 49 football​ games, where 27 of them were won by the home...

Consider a sample of 49 football​ games, where 27 of them were won by the home team. Use a 0.10 significance level to test the claim that the probability that the home team wins is greater than​ one-half. Identify the null and alternative hypotheses for this test. Choose the correct answer below. A. Upper H 0​: p equals 0.5 Upper H 1​: p less than 0.5 B. Upper H 0​: p equals 0.5 Upper H 1​: p greater than 0.5 C. Upper H 0​: p equals 0.5 Upper H 1​: p does not equal 0.5 D. Upper H 0​: p greater than 0.5 Upper H 1​: p equals 0.5 Identify the test statistic for this hypothesis test. The test statistic for this hypothesis test is nothing. ​(Round to two decimal places as​ needed.) Identify the​ P-value for this hypothesis test. The​ P-value for this hypothesis test is nothing. ​(Round to three decimal places as​ needed.) Identify the conclusion for this hypothesis test.

A.

Fail to reject

Upper H0.

There

is

sufficient evidence to support the claim that the probability of the home team winning is greater than​ one-half.

B.

Reject

Upper H0.

There

is

sufficient evidence to support the claim that the probability of the home team winning is greater than​ one-half.

C.

Reject

Upper H0.

There

is not

sufficient evidence to support the claim that the probability of the home team winning is greater than​ one-half.

D.

Fail to reject

Upper H0.

There

is not

sufficient evidence to support the claim that the probability of the home team winning is greater than​ one-half.

In: Statistics and Probability

After analysing several months of sales data, the owner of an appliance store produced the following...

After analysing several months of sales data, the owner of an appliance store produced the following joint probability distribution of the number of refrigerators (x) and stoves (y) sold daily. Refrigerators (x) Stoves (y) 0 1 2 0 0.08 0.14 0.12 1 0.09 0.17 0.13 2 0.05 0.18 0.04 a Find the marginal probability distribution of the number of refrigerators sold daily. b Find the marginal probability distribution of the number of stoves sold daily. c Compute the mean and variance of the number of refrigerators sold daily. d Compute the mean and variance of the number of stoves sold daily. e Compute the covariance and the coeffi cient of correlation.

In: Statistics and Probability

JAVA public class StringQueue {    //You may NOT add any more fields to this class....

JAVA

public class StringQueue {
   //You may NOT add any more fields to this class.
   private Stack<String> stack1;
   private Stack<String> stack2;

   /**
   * Initializes an empty queue.
   */
   public StringQueue() {
       // TODO
       throw new RuntimeException("Not Implemented");
   }

   /**
   * Returns true if this queue is empty.
   *
   * @return {@code true} if this queue is empty; {@code false} otherwise
   */
   public boolean isEmpty() {
       // TODO
       throw new RuntimeException("Not Implemented");
   }

   /**
   * Returns the number of items in this queue.
   *
   * @return the number of items in this queue
   */
   public int size() {
       // TODO
       throw new RuntimeException("Not Implemented");
   }


   /**
   * Adds the item to this queue.
   *
   * @param item the item to add
   */
   public void enqueue(String item) {
       // TODO
       throw new RuntimeException("Not Implemented");
   }

   /**
   * Removes and returns the item on this queue that was least recently added.
   *
   * @return the item on this queue that was least recently added
   * @throws NoSuchElementException if the queue is empty
   */
   public String dequeue() throws NoSuchElementException {
       // TODO
       throw new RuntimeException("Not Implemented");
   }

In: Computer Science