Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!