In the popular television game show of the 70s, Let's Make a Deal, game show host, Monty Hall, would show a contestant 3 doors. Behind one of the doors was a prize and the contestant would have to guess which one it was. Once the contestant made a guess which door led to the prize, Monty Hall would open of the other doors showing that the prize was not behind it. The contestant then had the opportunity of changing his or her guess or sticking to the original guess. Monty Hall would then open the door that concealed the prize.
The common place 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. So 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. But 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:
A sample session and output will look as follows:
Enter number of times you want to play: 10 Prize Guess View New Guess 2 2 3 1 1 3 2 1 1 1 2 3 3 1 2 3 3 1 2 3 3 1 2 3 2 2 3 1 2 1 3 2 3 2 1 3 2 1 3 2 Probability of winning if you switch = 0.70 Probability of winning if you do not switch = 0.30Your output must be in the above format. The column headers and the numbers are centered. You may want to use the printf() function. The probabilites are expressed correct to 2 places of decimal.
Your program should have a good, clean logical structure. You must print out the results in the format specified. We will be looking at good documentation, descriptive variable names, and adherence to the coding conventions discussed in class. Your file Deal.java will have the following header:
/* File: Deal.java Description: Student Name: Student UT EID: Course Name: CS 312 Unique Number: Date Created: Date Last Modified: */
You will follow the standard Java Coding Conventions. You can either view the HTML page or download the PDF or Postscript and print it out. There is a modification that I would like to make to the standard coding conventions. Please align the opening and closing braces vertically so that you can easily make out the blocks of code. For example:
Do this: if ( x > 5 ) { a = b + c; } Not this: if ( x > 5 ) { a = b + c; }
Use the turnin program to submit your Deal.java file. We should receive your work by 11 PM on Saturday 21 March 2012. There will be substantial penalties if you do not adhere to the guidelines.