Assignment #59 and ThreeCardMonte
Code
/// Name: Jason Kim
/// Period: 7
/// Program Name: ThreeCardMonte
/// File Name: ThreeCardMonte.java
/// Date Finished:10/30/15
import java.util.Scanner;
import java.util.Random;
public class ThreeCardMonte
{
public static void main (String [] args)
{
Random r = new Random();
Scanner keyboard = new Scanner(System.in);
int number = 1 + r.nextInt(3), guess;
System.out.println("You slide up to Fast Eddie's cart table and plop down your cash.");
System.out.println("He glances at you out of the corner of his eye and starts shuffling.");
System.out.println("He lays down three cars.");
System.out.println("\nWhich one is the ace?");
System.out.println("\t## ## ##");
System.out.println("\t## ## ##");
System.out.println("\t1 2 3 \n\n");
guess = keyboard.nextInt();
System.out.println();
if ( guess == number )
{
System.out.println("You nailed it! Fast Eddie reluctantly hands over your winnings, scowling.");
}
else
{
System.out.println("Ha! Fast Eddie wins again! The ace was card number " + number + ".");
}
System.out.println();
if ( number == 1 )
{
System.out.println("\tAA ## ##");
System.out.println("\tAA ## ##");
}
else if ( number == 2 )
{
System.out.println("\t## AA ##");
System.out.println("\t## AA ##");
}
else
{
System.out.println("\t## ## AA");
System.out.println("\t## ## AA");
}
}
}
Picture of the output