Question
I'm to create a blackjack game in java using the following two classes. import java.util.Random; /** * * @author user */ public class DeckOfCards {
I'm to create a blackjack game in java using the following two classes.
import java.util.Random; /** * * @author user */ public class DeckOfCards {
private Card[] deck; private int currentcard; private static final int Number_of_Cards = 52; private static final Random randomnumbers = new Random(); public DeckOfCards() { String[] faces = {"Ace", "Deuce", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King"}; String[] suits = {"Hearts", "Diamonds", "Clubs", "Spades"}; deck = new Card[Number_of_Cards]; currentcard = 0; for( int count= 0; count < deck.length; count++) { deck[count] = new Card(faces[count%13], suits[count/13]); } } public void shuffle() { currentcard = 0; for(int first = 9; first and public class Card { public String face; public String suit; public Card(String cardface, String cardsuit) { face = cardface; suit = cardsuit; } public String toString() { return face + "of" + suit; } }
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