Random Numbers #59 (Like the number guessing game, but with FANCY graphics!)
Code
/// Name: Amir Salehi
/// Period: 7
/// Program Name:Three Card Monte
/// File Name: ThreeCardMonte.java
/// Date Finished: 12/3/2015
import java.util.Random;
import java.util.Scanner;
public class ThreeCardMonte
{
public static void main ( String[] args )
{
Random r = new Random();
Scanner input = new Scanner(System.in);
int x = 1 + r.nextInt(3), 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.print("Which one is the ace?");
System.out.println("");
System.out.println(" ## ## ## ");
System.out.println(" ## ## ## ");
System.out.println(" 1 2 3 ");
guess = input.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! The ace was card number 3 ");
}
if (x == 1) {
System.out.println(" AA ## ## ");
System.out.println(" AA ## ## ");
System.out.println(" 1 2 3 ");
} if (x == 2) {
System.out.println(" ## AA ## ");
System.out.println(" ## AA ## ");
System.out.println(" 1 2 3 ");
} if (x == 3) {
System.out.println(" ## ## AA ");
System.out.println(" ## ## AA ");
System.out.println(" 1 2 3 ");
} else {
System.out.println("");
}
}
}
Picture(s) of the output