Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Herre is a new question in the exact way it was given. (I think its a full quest

ID: 3838224 • Letter: H

Question

Herre is a new question in the exact way it was given. (I think its a full question on its own but i'm not sure. The way she put it makes it seem like it's to be one large program containing all that she asked)

Black Jack pseudo code, steps to play a game.

Card class, instance variables, value and suit

Deck class with instance variables: an array, and position, you will NOT need setters and getters for this class, this is a utility class, you need the suffle(), and deal(), and toString()( print the entire deck).

Deck driver, display the deck before and after a shuffle.

Thank you for the help in advance.

---------------------------------------------------------------------------

Oh, I need this in Java! Sorry for leaving that out.

In addition, she left this for the driver part:

display the cards after you construct them,

shuffle the cards, then display they again.

deal two cards, show the cards.

I'd suppose she needs a program for playing blackjack itself.

----------------------------------------------------------------------------------------

I have sadly only 2 more hours to submit this. But take yout time regardless. Even if I do not submit this on time, I can at least see its correction and right code.

--------------------------------------------------------------------------------------------------

I will try my best to bring out what she's saying to do now:

She wants to see the psudocode used in making the program in java.

She also wants the code with the card class, instance variables, value and suit (The "Mechanics" or utilities of blackjack i would suppose?)

She wants to see the Deck class in the code too with instance variables: I suppose she means the array code you used to set up the deck. and apparently, "setters and getters" are not needed i believe she means you can put it right into the main code without having to put it in an entirely separate tab and calling like one would do in Raptor?

Finally, She wants to see the driver for the deck. It should appear before and after a shuffle.

I hope this helps! I can't make much more than that out of it sadly.

Explanation / Answer

import java.util.*; public class BlackJackGame { /* * Array list to store users and dealers cards */ public ArrayList usersCards = new ArrayList(); public ArrayList dealersCards = new ArrayList(); /* * Array for storing potential cards */ String[] card = { "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King", "Ace"}; /* * Dealer && User Variables */ int usersValue = 0; int dealersValue = 0; int usersDecision = 0; boolean userTwisting = false; boolean dealerTwisting = false; boolean dealerNotBust = true; /* * Scanner */ Scanner kb = new Scanner(System.in); BlackJackGame() { /* * Start Game */ /* * Generate Dealer && Users Cards * First Portion Of Game */ generateDealersCard(); generateUsersCard(); generateUsersCard(); displayUsersCards(); displayDealersCards(); checkBlackJack(); /* * Second Portion Of Game */ userOptions(); usersDecision = kb.nextInt(); do { if(usersDecision == 1) { generateUsersCard(); displayUsersCards(); checkBlackJack(); checkBust(); userOptions(); usersDecision = kb.nextInt(); } else { userTwisting = false; } }while(userTwisting == true); do { getDealersValue(dealersValue); checkDealersActions(); } while (dealerNotBust = true); } /* * Dealers Cards Value */ public int getDealersValue(int dValue) { dValue = 0; for(int i = 0; i 21) { System.out.println("Dealer Has Bust - You Win!"); System.exit(0); } if(usersValue > 21) { System.out.println("You've Bust - You Lose!"); System.exit(0); } } /* * Check Dealers Actions */ public void checkDealersActions() { getDealersValue(dealersValue); if(dealersValue 17) { System.out.println("Dealer Has: " + getDealersValue(dealersValue) + " - Sticking"); compareValues(); System.exit(0); } } public void userOptions() { System.out.println("Do You Want To: [1] Twist [2] Stick"); } public static void main(String[] args) { new BlackJackGame(); } }