Assignment #89 and BabyBlackjack
Code
/// Name: Jason Kim
/// Period: 7
/// Program Name: BabyBlackjack
/// File Name: BabyBlackjack.java
/// Date Finished:12/2/15
import java.util.Random;
public class BabyBlackjack
{
public static void main(String[] args)
{
Random r = new Random();
System.out.println("Baby Blackjack!\n");
int playerCard1 = 1 + r.nextInt(10), playerCard2 = 1 + r.nextInt(10), playerTotal = playerCard1 + playerCard2;
int dealerCard1 = 1 + r.nextInt(10), dealerCard2 = 1 + r.nextInt(10), dealerTotal = dealerCard1 + dealerCard2;
System.out.println("You drew " + playerCard1 + " and " + playerCard2 + ".");
System.out.println("Your total is " + playerTotal + ".\n");
System.out.println("The dealer has " + dealerCard1 + " and " + dealerCard2 +".");
System.out.println("Dealer's total is " + dealerTotal + ".");
if ( playerTotal < dealerTotal )
{
System.out.println("YOU LOSE!");
}
else if (playerTotal > dealerTotal)
{
System.out.println("YOU WIN!");
}
else
{
System.out.println("TIE!");
}
}
}
Picture of the output