For loops #89 (Did you know a stroller in the UK is called a "Boogy"?)
Code
/// Name: Amir Salehi
/// Period: 7
/// Program Name:Baby Black Jack
/// File Name:BabyBlackJack.java
/// Date Finished: 2/22/2016
import java.util.Random;
public class BabyBlackJack
{
public static void main( String[] args )
{
Random r = new Random();
System.out.println();
int p1 = 1 + r.nextInt(10);
int p2 = 1 + r.nextInt(10);
int d1 = 1 + r.nextInt(10);
int d2 = 1 + r.nextInt(10);
int t1 = p1 + p2;
int t2 = d1 + d2;
System.out.println( "Baby Blackjack!" );
System.out.println();
System.out.println( "You drew " + p1 + " and " + p2 + "." );
System.out.println( "Your total is " + t1 + "." );
System.out.println();
System.out.println( "The dealer has " + d1 + " and " + d2 + "." );
System.out.println( "Dealer's total is " + t2 + "." );
if ( t1 >= t2 )
{
System.out.println();
System.out.println( "YOU WIN!" );
}
if ( t1 <= t2 )
{
System.out.println();
System.out.println( "The dealer has won." );
}
System.out.println();
}
}
Picture(s) of the output