Create a simplified Blackjack game ( using Java ) using the Deck and Card classes (download the attached files to start). There is also a "TestCard" class that creates a Deck and runs some simple...

Create a simplified Blackjack game ( using Java ) using the Deck and Card classes (download the attached files to start). There is also a "TestCard" class that creates a Deck and runs some simple code. You may choose to use this file to help you get started with your game program. 1) Deal 2 cards to the "player" and 2 cards to the "dealer". Print both the player's cards, print one of the dealer's cards. Print the total value of the player's hand. 2) Ask the player if they want to "hit", i.e., if they want another card dealt to them. If they say yes, deal another card to the player, print the new "hand" of cards, print the new value of their hand, and check to make sure the player has not "busted" (gone over a total of 21). If the player busts, the game is over immediately and the dealer wins. 3) Repeatedly ask the player if they want to "hit" until they either bust or they decide to "stay" (no more cards dealt). To make the game a little simpler, if the player manages to get five cards in their hand, without busting, they automatically win ("Five Card Charlie"), end the game. 4) If the player stays without busting and fewer than five cards, print out all the dealer's cards and then repeatedly hit the dealer until the dealer's total is at least 17 or the dealer busts. If the dealer busts, the game is over immediately and the player wins. If the dealer's total reaches 17 or higher without busting, calculate the dealer's total and the player's total. The player closest to 21 wins. If there is a tie, just print that it is a tie. Note: The "face cards", Jack, Queen, King are all worth 10 points. The Ace is worth either 1 or 11 points. You will need to handle the totaling the Aces last after you've totaled the other cards to be able to determine if they should count as 1 or 11. They should count as 11 if they can do so without busting the hand. Note: Just make the game with the rules as described above. Don't worry about additional Blackjack rules like splitting, doubling-down, insurance, etc. You also don't need to implement any kind of "betting", just a one-hand game and who wins the hand. /* * a simple test program to use the Card class and the Deck class */ import java.util.Arrays; import java.util.ArrayList; public class TestCard { public static void main(String[] args) { //create a new Card and print it out // Card x = new Card(2,3); //3 of Hearts // System.out.println("x is the card: " + x); // System.out.println("suit of x is " + x.getSuit()); // System.out.println("rank of x is " + x.getRank()); //Card y = new Card(5, 1); //this is invalid because the suit is not in 0-3 range Deck d = new Deck(); //create a Deck of Card objects System.out.println("New deck of cards:\n" + d); //shuffle the deck and print it out again d.shuffle(); System.out.println("\nShuffled deck of cards:\n" + d); ArrayList player1 = new ArrayList(); for (int i=1; i player1.add(d.dealACard()); System.out.println("\nPlayer 1's cards: " + player1); System.out.println("\nRemaining cards in deck: " + d);
May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here