Question: ( Question requires java ) After the user selects a door, you need to reveal one of the doors using the following logic. If the

(Question requires java) After the user selects a door, you need to reveal one of the doors using the following logic. If the user selected the same door as the prize door, you should randomly select one of the other
two doors to reveal. If the user selected a different door than the prize door, you should reveal the door that is not the prize door and is not the door they selected.
After revealing a door, you will ask the user if they want to switch. If they do switch, the user's selected door will become the door that you did not reveal (and was not their original door).
Finally, with their door selection finalized, the user will win if their selected door matches the prize door.
Sample Outputs:
Welcome to Let's Make a Deal!
Pick a door, 1,2, or 3: 2
You picked door 2
I opened door 1
Switch doors (true or false): false
You win!
Welcome to Let's Make a Deal!
Pick a door, 1,2, or 3: 1
You picked door 1
I opened door 3
Switch doors (true or false): true
You switched to door 2
Sorry, you lose.Background
The Monty Hall Problem (or Paradox) is a mathematical brain teaser that is based on the classic game show Let's Make a Deal. On the show where Monty Hall is the host, the final deal asks
the contestant to pick one of three doors. Behind one door is the grand prize.
After contestants pick a door, Month Hall reveals one of the two doors that was not picked. He then asks the contestant if they want to stick with their original choice or switch to the other
door.
A majority of contestants choose to stick to their original choice. On the surface, it seems like the question of switching is a personal choice, however, when you switch, you actually double
your odds of winning the grand prize!
In this project, you are going to simulate this activity over a large number of iterations to demonstrate the results.
Setting up the Simulator
In this first activity, you are going to run the problem as if you were the game show host. You will use a random number generator to pick a door, then prompt the user for their choice. After
revealing one of the doors, you will then prompt the user to see if they want to switch their door. After finalizing their door, you will let the user know if they won.
Program Details
There are a few details that you need to follow, but how you implement the solution will be up to you.
First, you will need to prompt the user twice. The first prompt should be for an integer 1,2, or 3. The second prompt will be for a boolean (true or false) value. If you don't prompt the user for
these two values in that order, the autograder will fail.
After the user selects a door, you need to reveal one of the doors using the following logic. If the user selected the same door as the prize door, you should randomly select one of the other
two doors to reveal. If the user selected a different door than the prize door, you should reveal the door that is not the prize door and is not the door they selected.
After revealing a door, you will ask the user if they want to switch. If they do switch, the user's selected door will become the door that you did not reveal (and was not their original door).
Finally, with their door selection finalized, the user will win if their selected door matches the prize door.
 (Question requires java) After the user selects a door, you need

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!