Assignment 89
Code
/// Gian Adoremos
/// Period: 7
/// Program Name: EightyNinth Program
/// File Name: BabyBlackJack.java
/// Date Finished: 1/14/2016
import java.util.Random;
public class BabyBlackjack
{
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