Question: create a Java project with 3 source code files: Card.java to define the Card class; Deck.java to define the Deck class; and a file that

 create a Java project with 3 source code files: Card.java to define the Card class; Deck.java to define the Deck class; and a file that defines a main method definition to test ALL of the methods of your Card and Deck classes. This project illustrates two classes that exhibit a "has-a" relationship.

The Card is a very simple object that must be able to be constructed. The face value and suit are obvious attributes, although a Joker (which is a valid Card object) doesn't have an obvious suit. Don't confuse this card with a Jack. This class must have an indication as to whether it is face up or face down, and it must also have a toString( ) method which returns a String showing the face value and suit if the card is face up, or something else if it is face down (perhaps a block character).

The Deck is an object that can be one of three different kinds: Standard 52; Pinochle; or Canasta

A Standard 52 Deck is an object that has 52 cards. A Pinochle Deck has 48 cards which include the following Cards with 2 from each suit: A, 10, K, Q, J, 9. A Canasta Deck has 108 cards which includes 2 Standard 52 Decks and 4 Jokers. Your program must be able to create each of the 3 kinds of Decks of cards. You must have a toString( ) method to return a String of all of the Cards in your deck. You must also have a method to shuffle( ) the Deck object.

To test your Deck class, construct the deck and then display the String that is returned from the toString( ) method. Then shuffle the Deck and once again display the returned toString( ) value.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Cardjava Java public class Card private Rank rank private Suit suit private boolean faceUp public CardRank rank Suit suit thisrank rank thissuit suit ... View full answer

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 Programming Questions!