Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Let's Make a Deal! This project is based on the following modification - proposed by Marilyn Vos Savant - to the game show Let's make

image text in transcribedimage text in transcribed

image text in transcribed

Let's Make a Deal! This project is based on the following modification - proposed by Marilyn Vos Savant - to the game show "Let's make a Deal. A contestant is given a choice of three doors. Behind one door is an expensive car; behind each of the other door there is a goat. After the contestant makes initial guess, the announcer peeks behind the other two doors and eliminates one of them that does not have the car behind it. For example, if the initial guess is door two and the car is behind door 3, then the announcer will show that there is a goat behind door 1. If the initial guess is correct, the announcer will randomly decide which of the other two doors to eliminate. For example, if the initial guess is door 2 and the car is behind door 2, the announcer will randomly decide whether to show a goat behind door 1 or a goat behind door 3. After the initial guess has been made and the announcer has eliminated one of the other doors, the contestant must then make the final choice. The commonplace belief was that there was no real advantage in changing one's guess. The reasoning went as follows: since one of the doors was eliminated, the prize would be behind one of the two remaining doors, i.e. the probability of if being behind the door the contestant guessed was 0.5. The probability of the prize being behind the other door was also 0.5. Therefore, the prize being behind one of the two doors was just as likely as being behind the other door. It did not make sense to switch. In 1990, a reader of Parade magazine wrote to Marilyn vos Savant asking her what the best strategy would be to play this game. Her advice was, that no matter what the initial guess was, to switch. You should read all the comments that other readers sent her including college professors berating her for her suggestion. However, subsequent analysis has shown that she was right. In this programming assignment, you are going to simulate the game show and demonstrate that indeed Marilyn vos Savant gave sensible advice. The following describes the steps that you will be taking: 1. You will prompt the user to enter the number of times he or she wants to play this game. 2. You will create a variable to keep track of the number of times the contestant wins by switching. 3. Generate a random number between 1 and 3 (inclusive) that will denote the door that conceals the prize. 4. Generate another random number between 1 and 3 (inclusive) that will denote the guess the contestant makes 5. From those two numbers, compute a number that does not conceal the prize nor is it the contestant's guess. This is the door that is opened by Monty Hall and we shall call it view. 6. At this point the contestant changes his mind makes a newGuess that is not the original guess nor is it the view. 7. You will compare the value of the newGuess with that of prize. If they are the same, the contestant won by switching, and you increment the variable that was keeping track of 8. You will run this simulation for however many times the user had specified. 9. To obtain the probability for winning if you switch divide the number of times the contestant wins by switching by the total number of games played. 10. To obtain the probability of winning by not switching subtract the above number from A sample session and output will look as follows: Enter number of times you want to play: 10 Prize View that. one. NNNW 2 1 1 3 3 3 2 2 3 2 Guess 2 3 1 1 1 1 2 1 2 1 New Guess 1 1 3 3 3 3 1 L PL L Probability of winning if you switch = 0.70 Probability of winning if you do not switch = 0.30 Your output must be in the above format. The column headers and the numbers are centered. The probabilities are expressed correct to 2 places of decimal. Class name: Make A Deal

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

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago