Answered step by step
Verified Expert Solution
Question
1 Approved Answer
* * * In java * * * how do I improve this game? I can't figure out how to draw and read the cards
In java how do I improve this game? I can't figure out how to draw and read the cards correctly: import java.util.;
import java.util.ArrayList;
public class BlackJack
public static void mainString argsint bets;
int bank ;
int hit;
int playAgain ;
Deck gameDeck new Deck;
Card gameCard new Card;
int drawnCards ;
int dealerTotal ;
ArrayList bjDeck new ArrayList;
Scanner input new ScannerSystemin;
do
System.out.printlnWelcome to Blackjack you have $ bank;
System.out.printlnPlace your bets";
bets input.nextInt;
System.out.printlnHere are your cards";
gameDeck.drawCard;
bjDeck.addgameDeck;
gameDeck.drawCard;
bjDeck.addgameDeck;
System.out.printlnbjDeckget bjDeck.get;
System.out.printlnTotal is: "add drawn cards";
System.out.printlnDo you want a hit? yes no;
hit input.nextInt;
ifhit
draw another card and add to previous cards
draw dealer cards from the same deck and total them
System.out.printlnDealer Total "total dealer cards";
ifdealerTotal && drawnCards
System.out.printlnDealer Wins";
bank bank bets;
else
System.out.printlnDealer Busted";
bank bank bets;
else ifhit
draw dealer cards from the same deck and total them
System.out.printlnDealer Total "total dealer cards";
ifdealerTotal && dealerTotal drawnCards
System.out.printlnDealer Wins";
bank bank bets;
else
System.out.printlnDealer Busted";
bank bank bets;
System.out.printlnYour Bank: $ bank;
System.out.printlnDo you want to play again? yes no;
playAgain input.nextInt;
whileplayAgain ;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started