Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA help with separate clases f or the game of WAR. Create the following classes and add methods to perform the listed functionality: A DeckDriver

JAVA help with separate clases for the game of WAR.

Create the following classes and add methods to perform the listed functionality:

A DeckDriver class to run/test your application. We will be expanding this to test a variety of card games.

A Card class with the appropriate attributes/variables to track the number and suit of a card. Use enumerations to handle the Card suits and numeric values.

A GroupOfCards abstract class for different groups of cards. Groups of cards include a Deck and a Hand. These should be separate classes with the appropriate variables and methods. Use an ArrayList to store Card objects.

A Game interface utilized for playing games. Different games we will be adding in include BlackJack, Hearts, and War. Create Game as an interface that has three methods:

initialize()

play()

displayWinner()

Additional requirements:

The Deck constructor should initialize your ArrayList with the 52 cards found in a standard deck. Each card is a Card object. Each Card object contains two instance variables ? num and suit.

Code the ability to Shuffle a deck and orderHand to rearrange the cards in a hand from highest to lowest by suit.

A dealCard method should remove the next card in the deck.

A toString method for the deck should return the decks contents similar to the output displayed below.

A toString method for the hand to display the contents of the hand after the hand is ordered.

Use a constant to hold the number of rounds to play. Use this to verify that your application is working correctly.

Make sure you have a placeholder for the pile of cards that are being compared

Make sure you have a placeholder for each players pile as they win rounds

Create the methods to play the actual game of War. This should include the following:

o Splitting the deck (each player should have 26 cards to start)

o Comparing the top card from each player

o Determining a winner and putting the cards into the winning players pile

o Handling the scenario where a player (or both) has no more cards in his/their hand

o At this point the players pile should become the players hand

o Make sure that your cards come out in the proper order when you turn the pile over

o Handling the scenario of War where the players cards are the same value. In this scenario, make sure the following is done:

o Each player adds their next three cards to the pile and then turns over/compares their fourth card

o The winner of the fourth card comparison wins all the cards

o If there is a tie, this scenario continues

o Playing until the game ends (one player has all the cards) or the number of rounds played => the number of rounds constant

o Determining who is the winner of the game

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Structure Of The Relational Database Model

Authors: Jan Paredaens ,Paul De Bra ,Marc Gyssens ,Dirk Van Gucht

1st Edition

3642699588, 978-3642699580

More Books

Students also viewed these Databases questions

Question

5. Develop a strong introduction, a crucial part of all speeches

Answered: 1 week ago

Question

7. Explain why retirees may be valuable as part-time employees.

Answered: 1 week ago

Question

3. Provide advice on how to help a plateaued employee.

Answered: 1 week ago