Blackjack.java - import java.util/Took way longer than I...

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

import java.util.*; //Took way longer than I would like to say public class Blackjack { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); P1Random randomGen = new P1Random(); int gameNumber = 0; int gamesPlayed = 0; int handValue = 0; // player's hand value int handValueAugmented = 0; // reserves hand value from previous turn to add to value gained next turn int dealerWins = 0; double playerWins = 0; int tieGames = 0; double percentageWins = 0; String menuChoice = "menu"; while (!menuChoice.equals("4")) { if (menuChoice.equals("3")) { gameNumber = gameNumber - 1; } if (handValue >= 21 || handValue == 0) { System.out.println("START GAME #" + (gameNumber + 1) +"\n"); gameNumber = gameNumber + 1; int myNumber = randomGen.nextInt(13) + 1; if (myNumber == 1) { System.out.println("Your card is a ACE!"); } else if (myNumber >= 2 && myNumber <= 10) { System.out.println("Your card is a " + myNumber + "!"); } else if (myNumber == 11) { System.out.println("Your card is a JACK!"); } else if (myNumber == 12) { System.out.println("Your card is a QUEEN!"); } else { System.out.println("Your card is a KING!"); } if (myNumber >= 1 && myNumber <= 10) { handValue = myNumber; } else {

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture