Assignemnt #55 Three Card Monte

Code


///Name: JJ Deng
///Period: 6
///Program Name: Three Card Monte
///File Name: Cards.java
///Date Finished: 12/3/15    

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

public class Cards
{
    public static void main(String[] args)
    {
    
            
        Random r = new Random();
        Scanner keyboard = new Scanner(System.in);
            
        int guess, card;
            
        card = 1 + r.nextInt(3);
        
        System.out.println( "You slide up to Fast JJ'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.print( ">" );
        guess = keyboard.nextInt();
            
            
        if (card==1)
        {
            if ( guess == card )
            {
                    
                        System.out.println( "You nailed it! Fast JJ relectuantly hands over you winings, scowling." );
                        System.out.println( "       AA  ##  ## " );
                        System.out.println( "       AA  ##  ## " );
                        System.out.println( "       1   2   3 " );
                }
                else 
                {
                        System.out.println( "Ha Fast Eddie wins again! The ace was number " + card );
                        System.out.println( "       AA  ##  ## " );
                        System.out.println( "       AA  ##  ## " );
                        System.out.println( "       1   2   3 " );
                }
            }
            else if (card==2)
            {
                if (guess==card)
                {
                    System.out.println( "You nailed it! Fast JJ relectuantly hands over you winings, scowling." );
                        System.out.println( "       ##  AA  ## " );
                        System.out.println( "       ##  AA  ## " );
                        System.out.println( "       1   2   3 " );
                }
                else 
                {
                        System.out.println( "Ha Fast Eddie wins again! The ace was number " + card );
                        System.out.println( "       ##  AA  ## " );
                        System.out.println( "       ##  AA  ## " );
                        System.out.println( "       1   2   3 " );
                }
            }
            else if (card==3)
            {
                 if (guess==card)
                {
                    System.out.println( "You nailed it! Fast JJ relectuantly hands over you winings, scowling." );
                        System.out.println( "       ##  ## AA " );
                        System.out.println( "       ##  ## AA " );
                        System.out.println( "       1   2   3 " );
                }
                else 
                {
                        System.out.println( "Ha Fast Eddie wins again! The ace was number " + card );
                        System.out.println( "       ##  ##  AA " );
                        System.out.println( "       ##  ##  AA " );
                        System.out.println( "       1   2   3 " );
                }
            }
        }
    }

     

Picture of the output

Assignment 43