asd.txt - import java.util.Random import java.util.Scanner public class SeventySix cfw public static void main(String args cfw Scanner keyboard = new

asd.txt - import java.util.Random import java.util.Scanner...

This preview shows page 1 - 2 out of 3 pages.

import java.util.Random; import java.util.Scanner; public class SeventySix { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); //52 Cards, Aces = 11, Picture cards = 10, Ace's cannot be reduced to 1. int[] newCard = {2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7,8,8,8,8,9,9,9,9,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,11,11,11,11}; //Shuffle. Once per game. shuffleArray(newCard); //Start BlackJack. System.out.println("Welcome to BlackJack!"); System.out.println(); System.out.println("You get a " + newCard[0] + " and a " + newCard[1] + "."); int playerTotal = newCard[0] + newCard[1]; System.out.println("Your total is " + playerTotal + "."); System.out.println(); //Player can get blackjack/bust in the 1st deal. - awaiting betting system (enhanced bets for blackjack in first round) if (playerTotal == 21){ System.out.println("Blackjack, you win."); System.exit(0); } if (playerTotal > 21){ System.out.println("Bust, You lose."); System.exit(0); } // Dealer cards System.out.println("The dealer has a " + newCard[2] + " showing, and a hidden card."); int dealerTotal = newCard[2] + newCard[3]; if (dealerTotal > 21){ //Dealer bust check. System.out.println(); System.out.println("Dealers total is " + dealerTotal + "."); System.out.println("Dealer is bust, you win!");
Image of page 1
Image of page 2

You've reached the end of your free preview.

Want to read all 3 pages?

  • Fall '16
  • Fields

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture