Question
In this exercise, you must create a Java project with 3 source code files: Card.java to define the Card class; Deck.java to define the Deck
In this exercise, you must 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.
Note:
The deck class must have 3 kind of deck( Standard 52, A Pinochle 48cards and a Canasta Deck with 4 jokers )
The deck must have a shuffle, dealCard and a toString Method.
The card class must have a flip and a to string method. In addition the Card Class must have two getters(getFace & getSuit).
The conditions must be respected to have all the points
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started