Assignemnt #59: Three Card Monte

Code

    /// Name: Kelsey Lieberman
    /// Period 5
    /// Program Name: ThreeCardMonte
    /// File Name: ThreeCardMonte.java
    /// Date Finished: 12/3/2015
    
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), ans;
        
        System.out.println("You slide up to Fast Mel's card table and plop down your cash. He glances at you out of the corner of his eye and starts shuffling. He lays down three cards.");
        System.out.println("\nWhich one is the ace?\n");
        System.out.println("\t##  ##  ##\n\t##  ##  ##\n\t1   2   3\n");
        System.out.print("> ");
        
        ans = keyboard.nextInt();
        
        if ((ans == x)&&(x == 1))
        {
            System.out.println("You got it! Fast Mel reluctantly hands over your money. You got lucky this time\n");
            System.out.println("\tAA  ##  ##\n\tAA  ##  ##\n\t1   2   3\n");
        }
        if ((ans == x)&&(x == 2))
        {
            System.out.println("You got it! Fast Mel reluctantly hands over your money. You got lucky this time\n");
            System.out.println("\t##  AA  ##\n\t##  AA  ##\n\t1   2   3\n");
        }
        if ((ans == x)&&(x == 3))
        {
            System.out.println("You got it! Fast Mel reluctantly hands over your money. You got lucky this time\n");
            System.out.println("\t##  ##  AA\n\t##  ##  AA\n\t1   2   3\n");
        }
        if ((ans != x)&&(x == 1))
        {
            System.out.println("Ha! Fast Mel wins again! The ace was card number "+x+".\n");
            System.out.println("\tAA  ##  ##\n\tAA  ##  ##\n\t1   2   3\n");
        }
        if ((ans != x)&&(x == 2))
        {
            System.out.println("Ha! Fast Mel wins again! The ace was card number "+x+".\n");
            System.out.println("\t##  AA  ##\n\t##  AA  ##\n\t1   2   3\n");
        }
        if ((ans != x)&&(x == 3))
        {
            System.out.println("Ha! Fast Mel wins again! The ace was card number "+x+".\n");
            System.out.println("\t##  ##  AA\n\t##  ##  AA\n\t1   2   3\n");
        }
    }
}
    

Picture of the output

Assignment 59