Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I t i s time t o show off all o f your incredible talent and all that you have learned b y programming a
time show off all your incredible talent and all that you have learned programming a simple card game, will use the concept poker, but without actual cards. You will have three separate, internal classes that will:
Instantiate a Card
Instantiate a Deck those Cards, and shuffle and deal them.
Play the game.
this project you will simulate the playing a simple card game. You are given a Card and Deck class use. The Card class should not changed renamed; I will use own Card class when testing your files.
This assignment should submitted two classes; MainlastName, DecklastName. The first class, Deck, will a modification the class I have provided. You will need implement the shuffleDeck method order for this class usable, which has already been written for you a method the bottom.
The second class, Main, will use the Card class and your modified Deck class create a shuffled Deck object and deal the two hands. The hands should dealt alternating order, starting with the first hand. the cards are dealt into each hand they should removed from the deck.
For example, each hand shown for the following Deck.
seven spades Index top card
queen spades Index etc.
ten spades
eight spades
three spades
king hearts
queen hearts
jack clubs
four clubs
eight clubs
king diamonds
seven hearts
Hand : Hand :
seven spades queen spades
ten spades eight spades
three spades king hearts
queen hearts jack clubs
four clubs eight clubs
Each these cards should removed from the deck.
After dealing the hand, Main should use the point value attribute each card calculate the total point value each hand. The hand with the highest point value wins. the case a draw, the second hand wins. this game ace jack queen and king the deck the card the first position the top the deck.
Lastly, Main will declare the winning hand, and then ask the player they want play again. See the following sample run for the exact format that will expected.
Sample Run Main:
Hand : Total points
three clubs value
two clubs value
six hearts value
ten hearts value
ace spades value
Hand : Total points
four spades value
ten clubs value
three diamonds value
eight diamonds value
two hearts value
Hand wins
Play again
plan for the program, you should review the given classes. Knowing which methods are available you will very helpful designing your game. Then, you should plan the algorithms that you will design.
Use the following table plan your program.
Careck Methods & Variables Main
Card Methods & Variables
String suit, String rank, int pointValue
public Card cardRank, String cardSuit, int cardPointValue
public String suit
public String rank
public int getPointValue
public boolean matches otherCard
public String toString; use print each card with a for each
Deck Methods & Variables
private ArrayList deck;
constructor method; instantiate deck ArrayList object, populate elements with cards calling initialization method, and shuffle calling shuffleDeck for you
method initialize the deck with cards and set their point values; Ace Clubs through King Spades.
method return the top card from the deck and remove from the stack; return type should match what you are returning.
Main.main
instantiate a new Deck object based Card element types
establish two arrays, one for each hand dealt
deal cards each hand calling the getTopCard method from Deck
total the values for each hand using getPointValue from Card
display the cards and their point values for each hand
determine the winning hand and display
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