Question: In C + + please You are a contestant on a game show and have won a shot at the grand prize! Before you are

In C++ please
You are a contestant on a game show and have won a shot at the grand prize! Before
you are three doors. Behind one door is $1,000,000 in cash. Behind the other two
doors are the consolation prizes: a box of rice-a-roni. The location of the prizes has
been randomly selected. Naturally, you want the cash! The game show host asks you
to select a door, and you randomly pick one. However, before revealing the contents
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 switch your choice to the remaining door. What choice
should you make to optimize your chances of winning the grand prize, or does it
matter?
Write a simulation program to help you make your choice. Your program should
make 1000 simulated runs through the game show scenario where the player sticks
with the original choice, and 1000 runs where the player switches doors. This could
be the same program where you comment/uncomment some code that determines
if the player stays or switches doors (or do them both in the same program). For all
1000 runs the program should count up how many times the player won the cash.
The steps your program should make to simulate the game are:
1. Randomly select a door to have the cash prize (this could be a random number
that is 0,1, or 2).
2. Randomly select a door for the player to pick (another random number that is
0,1, or 2)
3. Compute a door that isn't the player's pick that doesn't have the cash prize
and reveal it
4. Stick with the original choice or switch to the remaining door, depending upon
what is being tested
5. Determine if the final door selection has the cash, and if so, increment the
number of times won
Be sure that your program simulates the process of selecting the door, revealing one,
then switching. Do not make assumptions about the actual solution. Turn in your
code, along with your answer of what choice to make based on your program's
output.
Insd

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!