Assignemnt #59 and Three Card Monte
Code
/// Name: Kyle Ivy
/// Period: 5
/// Program Name: ThreeCardMonte
/// File Name: ThreeCardMonte.java
/// Date Finished: 1/5/2016
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 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( " ## ## ## ");
System.out.println( " ## ## ## ");
System.out.println( " 1 2 3 ");
System.out.println();
System.out.print( " " );
guess = keyboard.nextInt();
if ( guess == x )
System.out.println( "You nailed it! Fast Eddie reluctantly hands over your winnings, scowling." );
else System.out.println( "Ha! Fast Eddie wins again!" );
System.out.println();
if ( x == 1 ){
System.out.println( " AA ## ## ");
System.out.println( " AA ## ## ");
System.out.println( " 1 2 3 ");
}
else if ( x == 2 ){
System.out.println( " ## AA ## ");
System.out.println( " ## AA ## ");
System.out.println( " 1 2 3 ");
}
else if ( x == 3 ){
System.out.println( " ## ## AA ");
System.out.println( " ## ## AA ");
System.out.println( " 1 2 3 ");
}
}
}
prog59.PNG