Assignemnt #59 and Three Card Monte
Code
///Name: Daniel Tiffany-Appleton
///Period: 7
///Program Name: Three Card Monte
///File Name: ThreeCardMonte
///Date Finished: 11/16/15
import java.util.Random;
import java.util.Scanner;
public class ThreeCardMonte
{
public static void main ( String[] args )
{
Random r = new Random();
Scanner keyboard = new Scanner(System.in);
int guessCard, aceCard;
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 ## ## ##" );
System.out.println( "\t ## ## ##" );
System.out.println( "\t 1 2 3" );
guessCard = keyboard.nextInt();
aceCard = 1 + r.nextInt(3);
if( guessCard != aceCard )
{
System.out.println( "" );
System.out.println( "Ha! Fast Eddie wins again! The ace was card number " + aceCard + "." );
}
else if ( guessCard == aceCard )
{
System.out.println( "" );
System.out.println( "You nailed it! Fast Eddie reluctantly hands over your winnings, scowling." );
}
System.out.println( "" );
if ( aceCard == 1 )
{
System.out.println( "\t AA ## ##" );
System.out.println( "\t AA ## ##" );
System.out.println( "\t 1 2 3" );
}
else if ( aceCard == 2 )
{
System.out.println( "\t ## AA ##" );
System.out.println( "\t ## AA ##" );
System.out.println( "\t 1 2 3" );
}
else if ( aceCard == 3 )
{
System.out.println( "\t ## ## AA" );
System.out.println( "\t ## ## AA" );
System.out.println( "\t 1 2 3" );
}
System.out.println( "" );
}
}
Picture of the output