Assignment #89 and Baby BlackJack
Code
///Name: Tim Gibson
///Period: 6
///Project Name: Baby BlackJack
///File Name: LetterAtATime.java
///Date Finished: 11/4/15
import java.util.Random;
public class BabyBlackjack
{
public static void main ( String[] args )
{
Random r = new Random();
int p1, p2, pt, d1, d2, dt; // pt = player total. dt = dealer total
System.out.println( "Baby Blackjack!\n" );
p1 = 1 + r.nextInt(10);
p2 = 1 + r.nextInt(10);
d1 = 1 + r.nextInt(10);
d2 = 1 + r.nextInt(10);
pt = p1 + p2;
dt = d1 + d2;
System.out.println( "You drew " + p1 + " and " + p2 + ". \nYour total is " + pt + "." );
System.out.println( "The dealer has " + d1 + " and " + d2 + ". \nDealer's total is " + dt + "." );
System.out.println();
if ( pt > dt )
System.out.println( "YOU WIN!" );
else
System.out.println( "You Lose." );
}
}
Picture of the output