This assignment will acquaint you with the use of while loops and boolean expressions. You will create a program that acts as a score keeper of a racquet ball game between two players. The program will continually ask the user who the winner of every point is as the game is played. It will maintain the scores and declare the match is over, using these rules: (1) A game is over when a. one of the players wins 7 points or, b. one of the players wins 3 points while the other player has 0 points. (2) The match is over when one of the players wins 2 games. The program will run a single match. See sample runs below. Write a complete class called RacquetBallMatch that has the following: • (8 points) playGame method: that plays one full game of 7 points between two players Allen and Bob. This method accepts a Scanner object and returns the name of the winner of this game. Specifically, this method repeatedly asks the user “who the winner of the next point is” until the game is over by following the rules mentioned above. The user is expected to enter the first letter of the player’s names, i.e. A for Allen and B for Bob. (Make the input case insensitive) See sample runs below. • (2 points) printGameScores method: accepts points of two players and prints the scores. See sample runs below. • (2 points) printMatchScores method: accepts game counts of two players and prints the scores. See sample runs below. • (5 points) main method: o Welcomes the user. o Declares and initializes a Scanner object to be used throughout to read user input. o Calls the playGame method repeatedly until the winner of a 3-game set can be declared. For example, if Bob wins the first 2 games, he would be declared the match winner and the program would stop. • (3 points) Include appropriate program documentation and formatting including: Your first and last name, the date of submission, code comments necessary to explain the operation of your program, and proper indentation of the code, etc. Notes: • For each of the methods, think about the following: What is the return type, what parameter(s) will it need to perform the task, and accordingly decide the method signature for each. • Don’t use static variables (variables that are declared outside of all the methods). It is ok to have class constants (variables declared with final keyword). • Use while-loops to handle the repetition. • Make sure there is no code-duplication. • Use a Boolean variable that captures the winning condition for a game or the match and use it in the while-loop conditions.
In: Computer Science
(All answers were generated using 1,000 trials and native Excel functionality.)
Statewide Auto Insurance believes that for every trip longer than 10 minutes that a teenager drives, there is a 1 in 1,000 chance that the drive will results in an auto accident. Assume that the cost of an accident can be modeled with a beta distribution with an alpha parameter of 1.5, a beta parameter of 3, a minimum value of $500, and a maximum value of $20,000. Construct a simulation model to answer the following questions. (Hint: Review Appendix 11.1 for descriptions of various types of probability distributions to identify the appropriate way to model the number of accidents in 500 trips.)
| (a) | If a teenager drives 500 trips longer than 10 minutes, what is the average cost resulting from accidents? | ||||
| Round your answer to the nearest whole number. | |||||
|
|||||
| Provide a 95% confidence interval on this mean. | |||||
| Round your answers to the nearest whole number. | |||||
|
| (b) | If a teenager drives 500 trips longer than 10 minutes, what is the probability that the total cost from accidents will exceed $8,000? | ||||
| Round your answer to a one decimal percentage. | |||||
|
|||||
| Provide a 95% confidence interval on this proportion. | |||||
| Round your answers to a one decimal percentage. | |||||
|
In: Statistics and Probability
A particular lake is known to be one of the best places to catch a certain type of fish. In this table, x = number of fish caught in a 6-hour period. The percentage data are the percentages of fishermen who caught x fish in a 6-hour period while fishing from shore.
| x | 0 | 1 | 2 | 3 | 4 or more |
| % | 45% | 37% | 13% | 4% | 1% |
(a) Convert the percentages to probabilities and make a histogram of the probability distribution.
(b) Find the probability that a fisherman selected at random
fishing from shore catches one or more fish in a 6-hour period.
(Round your answer to two decimal places.)
(c) Find the probability that a fisherman selected at random
fishing from shore catches two or more fish in a 6-hour period.
(Round your answer to two decimal places.)
(d) Compute μ, the expected value of the number of fish
caught per fisherman in a 6-hour period (round 4 or more to 4).
(Round your answer to two decimal places.)
μ = fish
(e) Compute σ, the standard deviation of the number of
fish caught per fisherman in a 6-hour period (round 4 or more to
4). (Round your answer to three decimal places.)
σ = fish
In: Statistics and Probability
Show calculations.
How large a sample size should be used to the 90% sure that the sample proportion p is within a margin of error E = .05. Show calculations.
In: Statistics and Probability
Stephanie Kerry is a very good basketball player. Each time she attempts a free throw, she misses it with a probability of only 5% (independently of other free throw attempts). This month, she will attempt 1000 free throws.
(a) What is the distribution of X, the total number of free throws that Stephanie misses this month? Give its name and compute its parameters.
(b) What is the probability that Stephanie will miss at least 61 free throws this month?
(c) Use a Poisson approximation to give an approximation for the probability that Stephanie will miss at least 61 free throws this month.
(d) By the end of the 15th day of the month, Stephanie has already missed 55 free throws. Given this information, what is the chance that she will miss at most 60 free throws in total this month? Use the Poisson approximation in answering this question.
(e) At the end of the month, Stephanie will look at her total number of missed free throws, X. If X ≥ 50, she will put 5 dollars in a jar for each free throw she misses. For example, she puts 250 dollars in the jar if X = 50. If X < 50, she will leave the jar empty. What is the expected number of dollars in the jar? Use the Poisson approximation in answering this question.
In: Statistics and Probability
A particular lake is known to be one of the best places to catch a certain type of fish. In this table, x = number of fish caught in a 6-hour period. The percentage data are the percentages of fishermen who caught x fish in a 6-hour period while fishing from shore.
| x | 0 | 1 | 2 | 3 | 4 or more |
| % | 43% | 34% | 15% | 7% | 1% |
(a) Convert the percentages to probabilities and make a histogram of the probability distribution.
(b) Find the probability that a fisherman selected at random
fishing from shore catches one or more fish in a 6-hour period.
(Round your answer to two decimal places.)
(c) Find the probability that a fisherman selected at random
fishing from shore catches two or more fish in a 6-hour period.
(Round your answer to two decimal places.)
(d) Compute μ, the expected value of the number of fish
caught per fisherman in a 6-hour period (round 4 or more to 4).
(Round your answer to two decimal places.)
μ = fish
(e) Compute σ, the standard deviation of the number of
fish caught per fisherman in a 6-hour period (round 4 or more to
4). (Round your answer to three decimal places.)
σ = fish
In: Statistics and Probability
Consider the observed frequency distribution for the set of random variables on the right. a. Perform a chi-square test using alphaequals0.05 to determine if the observed frequencies follow the binomial probability distribution when pequals0.50 and nequals4. b. Determine the p-value and interpret its meaning. Random Variable, x Frequency, fo 0 18 1 106 2 154 3 106 4 16 Total 400 a. State the appropriate null and alternative hypotheses. Choose the correct answer below. A. Upper H 0: The mean number of the random variable is equal to 0. Upper H 1: The mean number of the random variable is less than 0. B. Upper H 0: The mean number of the random variable is equal to 0. Upper H 1: The mean number of the random variable is not equal to 0. C. Upper H 0: The distribution of the random variable is binomial with nequals4 and pequals0.50. Upper H 1: The distribution of the random variable is not binomial with nequals4 and pequals0.50. D. Upper H 0: The distribution of the random variable is not binomial with nequals4 and pequals0.50. Upper H 1: The distribution of the random variable is binomial with nequals4 and pequals0.50. The chi-square test statistic is chi squaredequals nothing. (Round to two decimal places as needed.) The chi-square critical value is chi Subscript alpha Superscript 2equals nothing. (Round to three decimal places as needed.) Determine the proper conclusion. Choose the correct answer below. A. Do not reject the null hypothesis. There is not enough evidence to conclude that the random variable does not follow a binomial probability distribution with nequals4 and pequals0.50 . B. Reject the null hypothesis. There is not enough evidence to conclude that the random variable does not follow a binomial probability distribution with nequals4 and pequals0.50 . C. Reject the null hypothesis. There is enough evidence to conclude that the random variable does not follow a binomial probability distribution with nequals4 and pequals0.50. D. Do not reject the null hypothesis. There is enough evidence to conclude that the random variable does not follow a binomial probability distribution with nequals4 and pequals0.50. b. p-valueequals nothing (Round to three decimal places as needed.) State the appropriate conclusion. ▼ Do not reject Reject the null hypothesis because the p-value is ▼ less than greater than alpha. There is ▼ insufficient sufficient evidence to conclude that the observed frequency distribution does not follow a binomial probability distribution.
In: Statistics and Probability
1. At a certain restaurant in Ohio, the number of minutes that diners spend at the table has a major impact on the profitability of the restaurant. Suppose the average number of minutes that diners spend at a table for dinner at the restaurant is 97 minutes with a standard deviation of 18 minutes. Assume the number of minutes diners spend at their table follows the normal probability distribution. Complete parts a through d.
a. Calculate the probability that the average number of minutes that diners spend at their table for dinner will be less than 100 minutes using a sample size of 9 tables.
(Round to three decimal places as needed.)
2. According to the Bureau of Labor Statistics, Americans spent on average $2, 913 in 2016 on entertainment. Assume the population standard deviation of this spending is $863. A random sample of 28 adults was selected and was found to have an average spending of $2,725 on entertainment. Complete parts a and b.
a. Does this sample provide support for the conclusions of the BLS poll?
There is a .... chance of observing a sample mean as low as $2 comma 7252,725. This probability is ▼ low not low enough (0.05) to contradict the findings of the poll.
(Type an integer or decimal rounded to three decimal places as needed.)
3. The average weight of a professional football player in 2009 was 246.2 pounds. Assume the population standard deviation is 25pounds. A random sample of 32 professional football players was selected. Complete parts a through e.
a. Calculate the standard error of the mean. σ-x
4. According to a certain organization, adults worked an average of 1,783 hours last year. Assume the population standard deviation is 370 hours and that a random sample of 50 adults was selected. Complete parts a through e below.
a. Calculate the standard error of the mean. sigma Subscript x overbarσxequals=n
(Round to two decimal places as needed.)
5. A college has 250 full-time employees that are currently covered under the school's health care plan. The average out-of-pocket cost for the employees on the plan is $11,910 with a standard deviation of $520. The college is performing an audit of its health care plan and has randomly selected 35 employees to analyze their out-of-pocket costs.
a. Calculate the standard error of the mean.
b. What is the probability that the sample mean will be less than $1,860?
c. What is the probability that the sample mean will be more than $1,880?
d. What is the probability that the sample mean will be between $1,930 and $1,960?
a. The standard error of the mean is nothing.
(Round to two decimal places as needed.)
In: Statistics and Probability
Write a game where a user has to guess a number from 1 – 6, inclusive.
Your program will generate a random number once (pick a number), and will then prompts the user to guess the number for up to 3 times. If the user enters 3 wrong guesses, the program should be terminated along with the losing message. Once the user has successfully guessed the number, tell the user they win, and tell them how many guesses it took them to guess it right.
Use a loop to check your user input. Use string’s .isnumeric() to check to see if the user has provided you with a valid number before you use a cast to an integer. Your program should not crash if the user gives you bad input. Also if the user’s input wasn’t a digit, do not count it as one of the 3 chances that the user have to guess the number.
To create a random number use:
import random myRandomNumber = random.randint(1, 6)
Sample game:
I've picked a number between 1 and 6, can you guess it? 1 Nope, it's not 1 Your guess is too low I've picked a number between 1 and 6, can you guess it? 2 Nope, it's not 2 Your guess is too low I've picked a number between 1 and 6, can you guess it? 4 Nope, it's not 4 Your guess is too low You lost :'(. The random pick was 5.
And here is another run of the game that user wins:
I've picked a number between 1 and 6, can you guess it? 1 Nope, it's not 1 Your guess is too low I've picked a number between 1 and 6, can you guess it? 2 You got it! You won! :). It took you 2 guesses.
And here is an example that the user enters wrong inputs that are not digits:
I've picked a number between 1 and 6, can you guess it? hello You entered an invalid entry: hello. You must enter a digit. I do not count this for you! I've picked a number between 1 and 6, can you guess it? You entered an invalid entry: . You must enter a digit. I do not count this for you! I've picked a number between 1 and 6, can you guess it? 5 Nope, it's not 5 Your guess is too I've picked a number between 1 and 6, can you guess it? 4 Nope, it's not 4 Your guess is too high I've picked a number between 1 and 6, can you guess it? 2 You got it! You won! :). It took you 3 guesses.
In: Computer Science
A 1.5-Liter solution contains 45.0 mL of ethylene glycol. What is the volume percent of ethylene glycol in the solution?
In which group are ALL the molecules capable of hydrogen bonding?
|
C6H14, I2, CO2 |
||
|
HF, NH3, H2O |
||
|
CO, Ne, NaCl |
||
|
CH3F, HCN, H2 |
For which group of substances are dispersion forces the ONLY forces acting between molecules?
|
C6H14, I2, CO2 |
||
|
HF, NH3, H2O |
||
|
CO, Ne, NaCl |
||
|
CH3F, HCN, H2 |
Which pair of compounds will NOT mix to form a solution?
|
H2O and sugar (C12H22O11) |
||
|
butane (C4H10) and benzene (C6H6) |
||
|
H2O and benzene (C6H6) |
||
|
butane (C4H10) and hexane (C6H14) |
Ne
CO2
CH3OH
LiF
The substances shown above are ordered correctly from (Ne) lowest to (LiF) highest with respect to ________________
|
molar mass |
||
|
total number of valence electrons |
||
|
number of double bonds |
||
|
boiling point |
In: Chemistry