Assignemnt #89 and BabyBlackjack
Code
/// name: Leila Ordukhani
/// period: 6
/// program name: Seventy-Sixth Program
/// file name: BabyBlackjack.java
/// date finished: 2/19/16
import java.util.Random;
import java.util.Scanner;
public class BabyBlackjack
{
public static void main( String[] args )
{
Random r = new Random();
int x = 1 + r.nextInt(10);
int y = 1 + r.nextInt(10);
int z = 1 + r.nextInt(10);
int a = 1 + r.nextInt(10);
int total = 0;
int dtotal = 0;
total = total + x + y;
dtotal= dtotal + z +a;
System.out.println("You drew " + x + " and " + y);
System.out.println("Your total is " + total);
System.out.println("");
System.out.println("The dealer has " + z + " and " + a);
System.out.println("The dealers total is total is " + dtotal);
if ( total > dtotal)
{
System.out.println("You win!");
}
else
{
System.out.println("You lose");
}
}
}
Picture of the output