Assignemnt #59: Three Cards Number Generator
Code
/// Name: Sean Harrison
/// Period: 7
/// Program name: threecards
/// File Name: ThreeCards.java
/// Date Finished: 11/20/2015
import java.util.Scanner;
import java.util.Random;
public class ThreeCards
{
public static void main ( String[] args )
{
Random r = new Random();
Scanner keyboard = new Scanner(System.in);
int guess, number;
number = 1 + r.nextInt(3);
System.out.println( " You walk up to a pretty intense looking game of cards and take a seat. " );
System.out.println( " A man takes out three cards and shuffles them then lies them down on the table. " );
System.out.println( " Which card is the ace? " );
System.out.println( " ## ## ## " );
System.out.println( " ## ## ## " );
System.out.println( " 1 2 3 " );
guess = keyboard.nextInt();
if ( number == guess )
{
System.out.println( " You won, impressive well here are your winnings. " );
}
if ( number != guess )
{
System.out.println( "Looks like you lost this bet man, better luck next time. The correct number was " + number + "." );
}
if ( number == 1 )
{
System.out.println( " AA ## ## " );
System.out.println( " AA ## ## " );
}
else if ( number == 2 )
{
System.out.println( " ## AA ## " );
System.out.println( " ## AA ## " );
}
else if ( number == 3 )
{
System.out.println( " ## ## AA " );
System.out.println( " ## ## AA " );
}
System.out.println( " 1 2 3 " );
}
}
Picture of the output