Code
/// Name: Afaf Nabeeha
/// Period: 7
/// Program Name: Baby Blackjack
/// File Name: Baby.java
/// Date Finished: 3/8/2016 public class Baby
import java.util.Random;
public class Baby
{
public static void main( String[] args )
{
int p1value1, p1value2, p2value1, p2value2, p1Total, p2Total;
Random r = new Random();
System.out.println( "Baby Blackjack!" );
System.out.println();
p1value1 = 1 + r.nextInt(10);
p1value2 = 1 + r.nextInt(10);
p2value1 = 1 + r.nextInt(10);
p2value2 = 1 + r.nextInt(10);
p1Total = p1value1 + p1value2;
p2Total = p2value1 + p2value2;
System.out.println( "You drew " + p1value1 + " and " + p1value2 + "." );
System.out.println( "Your total is " + p1Total + "." );
System.out.println();
System.out.println( "The dealer has " + p2value1 + " and " + p2value2 + "." );
System.out.println( "Dealer's total is " + p2Total + "." );
System.out.println();
if ( p1Total > p2Total )
{
System.out.println( "YOU WIN!" );
}
else if ( p2Total > p1Total )
{
System.out.println( "YOU LOST!" );
}
else
{
System.out.println( "Draw" );
}
}
}
Picture of the output