Cornelius Eanes's Programming Portal
Assignments (Random Pt. 2)
[89] Baby Blackjack

GOAL: Create a simple, bare-bones blackjack game.

/// Name: Cornelius Eanes
/// Period: 5
/// Program Name: Baby Blackjack
/// File Name: BabyBlackjack.java
/// Date Finished: Feb 19, 2016

import java.util.Random;

public class BabyBlackjack {

    public static void main(String[] args) {

        Random rand = new Random();

        int p_num_1 = rand.nextInt(10) + 1;
        int p_num_2 = rand.nextInt(10) + 1;
        int d_num_1 = rand.nextInt(10) + 1;
        int d_num_2 = rand.nextInt(10) + 1;
        int p_total = p_num_1 + p_num_2;
        int d_total = d_num_1 + d_num_2;

        System.out.println("Baby Blackjack!\n");
        System.out.println("You drew " + p_num_1 + " and " + p_num_2 + ".");
        System.out.println("Your total is " + p_total + ".\n");
        System.out.println("The dealer has " + d_num_1 + " and " + d_num_2 + ".");
        System.out.println("Dealer's total is " + d_total + ".\n");
        if (p_total > d_total) {
            System.out.println("YOU WIN!");
        } else if (p_total == d_total) {
            System.out.println("YOU TIED!");
        } else {
            System.out.println("YOU LOST!");
        }

    }

}

Output