-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmontyHallGoat.java
More file actions
49 lines (42 loc) · 1.17 KB
/
montyHallGoat.java
File metadata and controls
49 lines (42 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//Project Name: Monty Hall (No Switching)
//Date: 12/18/2018
//Name: Adam Mason
/* Project Description
*/
import java.util.Random;
import java.util.Scanner;
public class montyHallGoat
{
public static void main(String [] args)
{
Scanner scan = new Scanner(System.in);
Random rand = new Random();
int correctDoor = rand.nextInt(3) + 1;
System.out.println(correctDoor);
int input, goatDoor;
System.out.println("Which door would you like to pick: ");
input = scan.nextInt();
if ( input == correctDoor )
{
if( correctDoor == 3 )
{
System.out.println("There is a goat behind Door #" + ((( correctDoor + 1 ) % 4) + 1) + ".");
}
else if( correctDoor != 3 )
{
System.out.println("There is a goat behind Door #" + (( correctDoor + 1 ) % 4) + ".");
}
}
else if ( input != correctDoor )
{
}
System.out.print("Would you like to change your choice (Y/N): ");
charInput = scan.nextLine().toLowercase().atChar(0);
if( charInput == 'y')
{
input =
}
System.out.println("The car was behind Door #" + correctDoor + "!");
}
}
//end-of-file