The Monte Hall Program Simulation Using the Monte Hall program simulation given
ID: 3736980 • Letter: T
Question
The Monte Hall Program Simulation Using the Monte Hall program simulation given in the slides and the first lab, modify the program to simulate how the actual Monte Hall Game is being played. In the actual game, the contestant selects a door, then Monte opens a door not selected by the contestant, and this always shows a worthless prize and then the contestant can choose to change their selection to the other door not opened by Monte Hall or stay with their first selection What you need to do in the simulation is to keep tract how many times that the contestant wins when they stick to their first decision and how many times that they win when they choose to change Simulate this for 1000 times and report your findingExplanation / Answer
/* * The Monty Hall Problem is a famous teaching problem * in statistics. It works like this: * * Imagine that you are on the show "Let's Make a Deal" * with Monty Hall. Monty shows you three doors and says * that a car exists behind one of them. You may pick * one door and if the car is behind it, you win the car. * * You pick a door. Monty then chances the rules. He opens * a different door and shows you that there was a goat * behind it. Good thing you didn't pick that door! * Monty gives you the opportunity to change to the other * unopened door. * * Which is better? Stick with your current door or to move * your choice to the other unopened door? Does this even * matter? There are now just two unopened doors. It should * be a 50-50 shot, right? * * Turns out it isn't. It take a little bit of thought to * determine why this is, but we can simulate the results * with a million iterations of someone who never changes * their choice and someone who always changes their choice. * * You'll have to run the program to see the results. */ import java.io.*; import java.util.*; public class monty { public static void main(String[] args) { Random rng = new Random(); int trials = 1000000; System.out.println("Player never changes the door."); int wins = 0; for (int i = 1; iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.