Assignment #59

Code

///Name: Conner Wygaerts
///Period: 6
///Project Name: ThreeCardMonte
///File Name: ThreeCardMonte.java
///Date Finished: 12/2/15

    import java.util.Random;
    import java.util.Scanner;

        public class ThreeCardMonte
{
	       public static void main ( String[] args )
	{
		Random r = new Random();
                
        int response, x = 1 + r.nextInt(3);
        
        Scanner keyboard = new Scanner(System.in);
 
        System.out.println("You slide up to Fast Eddie'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("");
        System.out.println("       ##    ##    ##");
        System.out.println("       ##    ##    ##");
        System.out.println("       1      2    3 ");

        System.out.print("Which one is the ace?");
        response = keyboard.nextInt();
                   
                if (response == x)
                   {
                       System.out.println("Nice you guessed correctly");
                   }
                   
                else
                   {
                       System.out.println("Looks like you got it wrong.");
                   }
        
         
            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");
            }
                   
                   }
                   }

Picture of the output

YourInitials.html