Consider a class called Building. This class consists of a number of floors (numberOfFloors) for the building, a current floor for the elevator (current), a requested floor of a person waiting for the elevator (requestedFloor), and methods for constructing the building object, for moving the elevator one floor up, for moving the elevator one floor down, for requesting the elevator and for starting the elevator going. Assume that requestedFloor will be set to 0 if there are currently no requests being made (or the last request has already been fulfilled).
Refer to Class Definition Ch 04-3: What visibility modifiers would you use for the methods that move the elevator up one floor, move the elevator down one floor, that request the elevator, and that start the elevator moving?
In: Computer Science
In: Other
Three people, X, Y, Z, in order roll an ordinary die. The first one to roll an even number wins. The game continues until someone rolls an even number. Determine the probability that either Y or Z will win.
In: Statistics and Probability
Niyat is a gambler and regularly plays several rounds of a gamble in which he wins $3,000 if even number of dots face up when a fair die is rolled twice and loses $1,000 for any other outcome from the two rolls of the die. In other words, the outcome of the gamble is determined by rolling a die twice on each round of the gamble and Niyat wins only if even number of dots show up on top in both rolls of the die and loses if any other outcome occurs. Niyat is considering playing 25 rounds of such a gamble next week hoping that she will win back the $1,500 she lost in a similar gamble last week. If we let X represent the number of wins for Niyat out of the next 25 rounds of the gamble, X will have the binomial probability distribution. a. Please calculate the probability of success for Niyat on each round of the gamble. Show how you arrived at your answer. b. What is the probability that Niyat will lose none of the 25 rounds of the gamble? c. What is the probability that Niyat will win more than half of the 25 rounds of the gamble? Show your work d. What is the probability that Niyat will win at least 8 out of the 25 rounds of the gamble? Show your work. e. What is the probability that Niyat will lose less than 20 of the 25 rounds of the gamble? Show your work. f. What is the probability that Niyat will lose at most 15 out of the 25 rounds of the gamble? Show your work g. How much money is Niyat expected to win in the 25 rounds of the gamble? How much money is she expected to lose? Given your results, do you think Niyat is playing a smart gamble? Please show how you arrived at your results and explain your final answer. h. Calculate and interpret the standard deviation for the number of wins for Niyat in the next 25 rounds of the gamble. Show your work.
In: Statistics and Probability
Peter and Mary take turns rolling a fair die. If Peter rolls 1
or 2 he wins and the game stops. If Mary rolls 3, 4, 5, or 6, she
wins and the game stops. They keep rolling in turn until one of
them wins. Suppose Peter rolls first.
(a) What is the probability that Peter wins? (b) What is the
probability that Mary wins?
In: Statistics and Probability
A table tennis match is played between Jack and Rose. The winner of the match is the one who first wins 4 games in total, and in any game the winner is the one who first scores 11 points. Note that in an individual game, if the score is 10 to 10, the game goes into extra play (called deuce) until one player has gained a lead of 2 points. Let p be the probability that Rose wins a point in any single round of serve, and assume that different rounds in all games are independent. (i) How many games can there be at most before a match winner appears? (ii) In a given individual game, what is the probability that the game runs into the deuce stage? (iii) Suppose that p = 0.6. Compute the probability that Rose wins the match? (iv) As a function of p, let F(p) be the probability that the match ends with a maximal number of games. For what value(s) of p is F(p) largest? Justify your answer and compute the resulting probability.
In: Statistics and Probability
An elevator has a placard stating that the maximum capacity is
16201620
lblong dash—1010
passengers. So,
1010
adult male passengers can have a mean weight of up to
1620 divided by 10 equals 162 pounds.1620/10=162 pounds.
If the elevator is loaded with
1010
adult male passengers, find the probability that it is overloaded because they have a mean weight greater than
162162
lb. (Assume that weights of males are normally distributed with a mean of
171 lb171 lb
and a standard deviation of
26 lb26 lb.)
Does this elevator appear to be safe?An elevator has a placard stating that the maximum capacity is
16201620
lblong dash—1010
passengers. So,
1010
adult male passengers can have a mean weight of up to
1620 divided by 10 equals 162 pounds.1620/10=162 pounds.
If the elevator is loaded with
1010
adult male passengers, find the probability that it is overloaded because they have a mean weight greater than
162162
lb. (Assume that weights of males are normally distributed with a mean of
171 lb171 lb
and a standard deviation of
26 lb26 lb.)
Does this elevator appear to be safe?
In: Statistics and Probability
An elevator has a weight capacity of 3000 lbs. Sixteen men get into the elevator. Given the weights of men are normally distributed with a mean of 172 lbs and a std dev of 29 lbs find the probability of these men exceeding the maximum weight, thus breaking the cable and plunging to their death. _________
In: Statistics and Probability
1. Write a program that plays a simple dice game between the
computer and the user. When the program runs, it asks the user to
input an even number in the interval [2..12], the number of plays.
Display a prompt and read the input into a variable called ‘plays’
using input validation. Your code must ensure that the input always
ends up being valid, i.e. even and in [2..12].
2. A loop then repeats for ‘plays’ iterations. Do the following for
each iteration:
generate a random integer in the range of 1 through 6; this is
the face value of the
computer’s die; output it clearly labeled as ‘computer’s die’
generate another random integer in the range of 1 through 6; this
is the face value of
the user’s die; output it clearly labeled as ‘user’s die’
the die with the highest value wins; display the winner for this
iteration, computer or
user, or state it was a tie
3. As the loop iterates, the program keeps count of the number of
times the computer wins, and of the number of times that the user
wins. After the loop performs all of its iterations, the program
displays the grand winner, the computer or the user, or it states
that the game was tied.
In: Computer Science
At a charity event, a player rolls a pair of dice. If the player roles a pair (same number on each die), the player wins $10. If the two are exactly one number a part (like a five and a six), the player wins $6. IF the player roles a one and a six, they win $15. Otherwise, they lose. If it cost $5 to play, find the expected value. Write a complete sentence to explain what your answer means without words "Expected value". Show all work for full credit including the probability distribution.
In: Math