Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Code in C please! :) You are a contestant on a game show and have won a shot at the grand prize! Before you are

Code 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 a Lamborghini. Behind the other two doors are the consolation prizes: a can of tomatoes. The location of the prizes have been randomly selected. Naturally, you want the car! 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 car. The steps your program should make to simulate the game are:

  1. Randomly select a door to have the car (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 car 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 car, 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.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions

Question

Why are pizzas usually round?

Answered: 1 week ago

Question

How effective was the school improvement plan?

Answered: 1 week ago

Question

Data points include: surveys, discipline, demographics

Answered: 1 week ago

Question

What environmental factors influenced achievement?

Answered: 1 week ago