Question: Create an abstract CardGame.java class. The class contains a deck of 52 playing cards that uses a Card.java class to hold a suit(Spades, Hearts, Diamonds,
Create an abstract CardGame.java class. The class contains a deck of 52 playing cards that uses a Card.java class to hold a suit(Spades, Hearts, Diamonds, and Clubs), rank(Ace, 2, 3, 4, 5,6, 7,8,9,10, Jack, Queen, and King), and value for each Card (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14) object. It also contains an integer field that holds the number of cards dealt to a player in a particular game. The class contains a constructor that initializes the deck of cards with appropriate values (e.g., King of Hearts), and a shuffle() method that randomly arranges the positions of the Cards in the array. The class also contains two abstract methods: displayDescription(), which displays a brief description of the game in each of the child classes, and deal(), which deals the appropriate number of Card objects to one player of a game. Save the file as CardGame.java. b. Create one child class, Poker class that extends CardGame. Create a constructor for each child class that initializes the field that holds the number of cards dealt to the correct value. (For example, in standard poker, a player receives five cards.) Create an appropriate displayDescription() and deal() method for the Poker child class. Save the file using an appropriate namefor example, Poker.java. c. Create an application that instantiates the Pokers object, player1 and player2 of the game type and display the suit, rank, and value for the 5 cards in each players hand. Save the application as PlayCardGames.java.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
