Assignemnt #59 Three Card Monte
Code
/// Name: Jake Johnson
/// Period: 7
/// Program Name: ThreeCardMonte
/// File Name: ThreeCardMonte.java
/// Date Finished: 12/3/2015
import java.util.Scanner;
import java.util.Random;
public class ThreeCardMonte
{
public static void main (String [] args)
{
Scanner keyboard = new Scanner (System.in);
Random r = new Random();
int x = 1 + r.nextInt(3);
int guess;
System.out.println("You go to the cassino and you see a guy with three cards on the table.");
System.out.println("You aprouch him and ask him about the game. He Tells you to pick one of the three cards");
System.out.println("if you get an Ace you win if not you dont." + "\n");
System.out.println( "\t##\t##\t##" );
System.out.println( "\t##\t##\t##\n" );
System.out.println( "\t 1\t 2\t 3" );
guess= keyboard.nextInt();
if ((guess == x)&&(x==1))
{
System.out.println("\t" + "AA" + "\t" + "##" + "\t" + "##");
System.out.println("\t" + "AA" + "\t" + "##" + "\t" + "##" +"\n");
System.out.println("\t" + " 1" + "\t" + " 2" + "\t" + " 3" + "\n");
System.out.println("You naied it the dealer hands over the money ");
}
else if ((guess == x)&&(x==2))
{
System.out.println("\t" + "##" + "\t" + "AA" + "\t" + "##");
System.out.println("\t" + "##" + "\t" + "AA" + "\t" + "##" +"\n");
System.out.println("\t" + " 1" + "\t" + " 2" + "\t" + " 3" + "\n");
System.out.println("You naied it the dealer hands over the money");
}
else if ((guess == x)&&(x==3))
{
System.out.println("\t" + "##" + "\t" + "##" + "\t" + "AA");
System.out.println("\t" + "##" + "\t" + "##" + "\t" + "AA" +"\n");
System.out.println("\t" + " 1" + "\t" + " 2" + "\t" + " 3" + "\n");
System.out.println("You naied it the dealer hands over the money");
}
else if ((x > guess)&&(x==2))
{
System.out.println("\t" + "##" + "\t" + "AA" + "\t" + "##");
System.out.println("\t" + "##" + "\t" + "AA" + "\t" + "##" +"\n");
System.out.println("\t" + " 1" + "\t" + " 2" + "\t" + " 3" + "\n");
System.out.println("You lost sorry your guess was to low give the dealer your money. It was number " +x);
}
else if ((x > guess)&&(x==3))
{
System.out.println("\t" + "##" + "\t" + "##" + "\t" + "AA");
System.out.println("\t" + "##" + "\t" + "##" + "\t" + "AA" +"\n");
System.out.println("\t" + " 1" + "\t" + " 2" + "\t" + " 3" + "\n");
System.out.println("You lost sorry your guess was to low give the dealer your money. It was number " +x);
}
Picture of the output