Assignment #59 Three-Card Monte
Code
///Name: Ian Grant
///Period:5
///Project Name: Three-Card Monte
///File Name:Goat.java
///11/9/15
import java.util.Random;
import java.util.Scanner;
public class Goat
{
public static void main(String[] args)
{
Scanner stuff = new Scanner(System.in);
Random r = new Random();
int goat,gus;
goat=1+r.nextInt(3);
System.out.println("You are on a gameshow and are trying to win the goat and not the two cars, that are behind one of these doors.");
System.out.println("There are three door which one do you choose?");
System.out.println("\t ### ### ###");
System.out.println("\t ### ### ###");
System.out.println("\t ### ### ###");
System.out.println("\t 1 2 3 ");
gus=stuff.nextInt();
if (gus==goat)
{
System.out.println("Congrats! You have won the compeletly normal goat.");
if (goat==1)
{
System.out.println("\t GOAT CAR CAR");
System.out.println("\t GOAT CAR CAR");
System.out.println("\t GOAT CAR CAR");
System.out.println("\t 1 2 3 ");
}
else if (goat==2)
{
System.out.println("\t CAR GOAT CAR");
System.out.println("\t CAR GOAT CAR");
System.out.println("\t CAR GOAT CAR");
System.out.println("\t 1 2 3 ");
}
else if (goat==3)
{
System.out.println("\t CAR CAR GOAT");
System.out.println("\t CAR CAR GOAT");
System.out.println("\t CAR CAR GOAT");
System.out.println("\t 1 2 3 ");
}
}
else
{
System.out.println("Sorry, you won the car. Not the goat.");
if (goat==1)
{
System.out.println("\t GOAT CAR CAR");
System.out.println("\t GOAT CAR CAR");
System.out.println("\t GOAT CAR CAR");
System.out.println("\t 1 2 3 ");
}
else if (goat==2)
{
System.out.println("\t CAR GOAT CAR");
System.out.println("\t CAR GOAT CAR");
System.out.println("\t CAR GOAT CAR");
System.out.println("\t 1 2 3 ");
}
else if (goat==3)
{
System.out.println("\t CAR CAR GOAT");
System.out.println("\t CAR CAR GOAT");
System.out.println("\t CAR CAR GOAT");
System.out.println("\t 1 2 3 ");
}
}
}
}
Output