Assignment #59
Code
///jack newsom
///period 5
///program name CardMonte
///filename CardMonte.java
///date completed 10/6/15
import java.util.Random;
import java.util.Scanner;
public class CardMonte
{
public static void main( String [] args )
{
Random r = new Random();
Scanner cardbot = new Scanner(System.in);
System.out.println("You slide up to Fast Eddie's card 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 cards.");
System.out.println("");
System.out.println("Which one is the ace?");
System.out.println("");
System.out.println("\t## \t## \t##");
System.out.println("\t## \t## \t##");
System.out.println("\t1 \t2 \t3");
int guess = cardbot.nextInt();
int actual = r.nextInt(2) + 1;
if ( actual == 1)
{
//cup 1
if ( guess == actual )
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 1.");
System.out.println("");
System.out.println("\tAA \t## \t##");
System.out.println("\tAA \t## \t##");
System.out.println("\t1 \t2 \t3");
}
else if ( actual == 2 )
{
//cup 2
if ( guess == actual )
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 2.");
System.out.println("");
System.out.println("\t## \tAA \t##");
System.out.println("\t## \tAA \t##");
System.out.println("\t1 \t2 \t3");
}
else
{
//cup 3
if ( guess == actual )
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 3.");
System.out.println("");
System.out.println("\t## \t## \tAA");
System.out.println("\t## \t## \tAA");
System.out.println("\t1 \t2 \t3");
}
}
}
Picture of the output