Computers and Technology

You are a contestant on a game show and have won a shot at the grand prize. Before you are three doors. $1,000,000 in cash has randomly been placed behind one door. Behind the other two doors are the consolation prizes of dishwasher detergent. The game show host asks you to select a door, and you randomly pick one. However, before revealing the prize behind your door, the game show host reveals one of the other doors that contains a consolation prize. At this point, the game show host asks if you would like to stick with your original choice or to switch to the remaining door.

Write a function to simulate the game show problem. Your function should randomly select locations for the prizes, select a door at random chosen by the contestant, and then determine whether the contestant would win or lose by sticking with the original choice or switching to the remaining door. You may wish to create additional functions invoked by this function.

Next, modify your program so that it simulates playing 10,000 games. Count the number of times the contestant wins when switching versus staying. If you are the contestant, what choice should you make to optimize your chances of winning the cash, or does it not matter?

Testing your program:

This program will be much longer than previous assignments. You should develop it incrementally, testing each new part as you go. Use cout statements in your debugging when needed to keep track of program flow and/or the value of variables.

Your program should output the percentage of wins that would happen if you switched and if you stayed. While the exact number may be different due to the randomness, the law of averages will make them very close to a correct solution

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 06:30, Melissamv2052
Selective incapacitation is a strategy to reduce prison population
Answers: 3
image
Computers and Technology, 22.06.2019 19:10, sammigrace5820
How might the success of your campaign be affected if you havenโ€™t carefully completed all field data or if you accidentally insert the wrong merge field in the document?
Answers: 1
image
Computers and Technology, 23.06.2019 02:00, mayapril813
Consider the following function main: int main() { int alpha[20]; int beta[20]; int matrix[10][4]; . . } a. write the definition of the function inputarray that prompts the user to input 20 numbers and stores the numbers into alpha. b. write the definition of the function doublearray that initializes the elements of beta to two times the corresponding elements in alpha. make sure that you prevent the function from modifying the elements of alpha. c. write the definition of the function copyalphabeta that stores alpha into the first five rows of matrix and beta into the last five rows of matrix. make sure that you prevent the function from modifying the elements of alpha and beta. d. write the definition of the function printarray that prints any onedimensional array of type int. print 15 elements per line. e. write a c11 program that tests the function main and the functions discussed in parts a through d. (add additional functions, such as printing a two-dimensional array, as needed.)
Answers: 3
image
Computers and Technology, 23.06.2019 07:30, kimhoss2
What are ways to switch windows in excel? check all that apply. on the status bar, click the windows button, and then click the file name. on the task bar, click to display the excel jump list, and then click the file name. on the view tab, in the window group, click switch windows, and then click the file name. on the review tab, in the viewing group, click files, and then click the file name.
Answers: 1
Do you know the correct answer?
You are a contestant on a game show and have won a shot at the grand prize. Before you are three doo...

Questions in other subjects:

Konu
Mathematics, 14.11.2020 03:10
Konu
Spanish, 14.11.2020 03:10
Konu
Mathematics, 14.11.2020 03:10