Question: This should be done in java as simply as posible create multiple classes that generate a deck of cards with 2 gambler players that will
This should be done in java as simply as posible
create multiple classes that generate a deck of cards with 2 gambler players that will have a certain hand of cards.
create a cardDeck class that contains all the possible cards of a regular deck
Create a Card class that represents each card.
create an object from the cardDeck class In the main method
Create 2 gambler player objects with any names
Make a loop that gives five playing cards to both the players.
Print both Player objects in order to display the player's name and hand of cards
In the cardDeck class
The card deck has one instance variable and will contain a card object array with room for 52 cards
Have the cardDeck class constructor fill the card deck array with all the different 52 cards. This includes the ranks- 1,2,3,4,5,6,7,8,9,10, jack, queen, king, ace. Also include the suits- clubs, hearts, spades, and diamonds
Create a loop that goes through suits and ranks arrays.
Create one card object for every suit and rank combination
Create a method for dealing the playing cards that subtracts a random card from the card deck and adds it to the hand of the gambler. This should return just one card object.
playingCard class
make the ranks and suits Strings
Each playing card will contain a rank and suit
Cards rank and suit should set by constructor
toString method of this class to display as "Four of Clubs" for example
Gambler class
-
A Gambler consists of a name. Each gambler also has 5 card object array
Have the gambler class constructor to establish the gamblers name and make an array that is empty.
gambler class contains addPlayingCard method that will have a playing card object as its parameter. This method should add cards to the gamblers hand which is an array of cards hand
Print gamblers name and their cards using toString
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
