Assignment #89 and Baby Blackjack
Code
/// Name: Brendan Baird
/// Period: 6
/// Program Name: Baby Blackjack
/// File Name: BabyBlack.java
/// Date Finished: 12/10/2015
import java.util.Random;
public class BabyBlack
{
public static void main(String[] args)
{
Random r = new Random();
int card1 = 1 + r.nextInt(10);
int card2 = 1 + r.nextInt(10);
int deal1 = 1 + r.nextInt(10);
int deal2 = 1 + r.nextInt(10);
System.out.println("Baby Blackjack!");
int playerTotal = card1 + card2;
System.out.println("You drew " + card1 + " and " + card2 + ".");
System.out.println("Your total is " + playerTotal + ".");
int dealTotal = deal1 + deal2;
System.out.println("The dealer has " + deal1 + " and " + deal2 + ".");
System.out.println("Dealer's total is " + dealTotal + ".");
System.out.println();
if (playerTotal > dealTotal)
System.out.println("YOU WIN!");
else if (playerTotal < dealTotal)
System.out.println("YOU LOSE!");
else if (playerTotal == dealTotal)
System.out.println("DRAW!");
}
}
Picture of the output