Created
October 30, 2018 20:10
-
-
Save postnati/5545d3f1fbe5e20d0ff40aebd85e5e63 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.bluemedora; | |
public class Main { | |
public static void main(String[] args) { | |
/* ------------------------------------------------------------------------------------------------------------- | |
* The Game | |
* A single grand prize is behind Door A, B, or C. The other two doors have a goat behind them. | |
* | |
* 1 - Host randomly puts a grand prize behind a single door and a goat behind the other two doors. | |
* 2 - Contestant picks door A, B, or C | |
* 3 - Host reveals what is behind a single door that the contestant did NOT pick and does NOT have the | |
* grand prize. Meaning the host always reveals a goat. | |
* 4 - After host reveals a goat, the contestant is given the option to stay with the original door picked or | |
* switch to the other door the host did not reveal | |
* | |
* The Exercise | |
* Write a program that executes 10,000 runs of the game. Track and output the number of times out of 10,000 | |
* the contestant wins if they would stay, and the number of times they would have won if they switched. | |
* | |
* Example Output | |
* Won XXXX games out of 10000 when staying with original door | |
* Won XXXX games out of 10000 when switching to other door | |
* | |
* The Question | |
* Look at the output of your program. Should the contestant always stay, always switch, or doesn't matter? | |
------------------------------------------------------------------------------------------------------------- */ | |
Integer NUMBER_OF_GAMES_TO_PLAY = 10000; | |
playAllLetsMakeADealGames(NUMBER_OF_GAMES_TO_PLAY); | |
} | |
private static void playAllLetsMakeADealGames(Integer numberOfGames) { | |
// Implementation goes here | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment