Question: Write a class named Card which will represent a card from a deck of cards. A card has a suit and a face value. Suits

Write a class named Card which will represent a card from a deck of cards. A card has a suit and a face value. Suits are in order from low to high: Clubs, Diamonds, Hearts and Spades. The card values from low to high: 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King, and Ace.

Write a Deck class that contains 52 cards. The class needs a method named shuffle that randomly shuffles the cards in the deck. It also needs a method to deal one card at a time.

Write a CardPlayer class. This class should keep a list of card objects. (The class represents a hand of cards.) This class should have a method getCard, that accepts a reference to a card object and adds it to the CardPlayer. The class should also have a method named showCards that will display all of the cards held by a CardPlayer object.

Write a separate Demonstration that creates a deck of cards, creates two CardPlayer objects, deals 5 cards to each CardPlayer object, one at a time, and displays both hands.

Please make sure you comment your code thoroughly.

The code should be nicely formatted and should use proper variables. ( java programming )

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!