Design an object card
Design an object Deck
Design a driver program

Use these class diagrams to create your objects.

————————————-
                    Card
————————————-
-int _value
-String _suit
-String _Color
-String _Face
————————————-
+Card(int value, String suit)
+String toString()
+String getColor()
+String getFace()
+int getValue()
+String getSuit()
————————————

————————————
                    Deck
————————————
-List <Card> _cards
————————————
+Deck()
-void loadCards()
+Card drawCard()
+int getDeckSize()
+void shuffle()
————————————

Write a driver program that produces the output below.
Your program must match the provided class diagrams.
The program must draw a card randomly from a standard deck of 52 cards.
Your program must not print the same card twice until the deck runs out.
Your program must shuffle the deck when it runs out of cards.
Your program should produce different output every time it runs (Based on randomly selecting cards)
Each object and the driver program should be in separate files.

SAMPLE RUN #1: java Driver

Printing 79 random cards

Jack of Spades
5 of Diamonds
10 of Spades
3 of Clubs
Ace of Diamonds
King of Clubs
King of Hearts
7 of Clubs
2 of Diamonds
8 of Spades
9 of Clubs
2 of Spades
Ace of Spades
2 of Clubs
10 of Hearts
3 of Spades
2 of Hearts
4 of Spades
7 of Spades
Queen of Spades
10 of Diamonds
3 of Diamonds
Queen of Hearts
6 of Diamonds
9 of Hearts
King of Diamonds
4 of Diamonds
8 of Hearts
Jack of Hearts
Queen of Clubs
Ace of Hearts
7 of Diamonds
10 of Clubs
9 of Diamonds
Jack of Diamonds
Queen of Diamonds
4 of Clubs
6 of Hearts
8 of Diamonds
6 of Spades
7 of Hearts
3 of Hearts
8 of Clubs
5 of Spades
9 of Spades
5 of Hearts
King of Spades
4 of Hearts
6 of Clubs
Ace of Clubs
5 of Clubs
Deck is empty, shuffling!
Queen of Hearts
6 of Diamonds
4 of Spades
7 of Diamonds
Queen of Clubs
4 of Diamonds
8 of Hearts
King of Diamonds
5 of Spades
Jack of Clubs
7 of Hearts
7 of Clubs
2 of Diamonds
6 of Hearts
6 of Clubs
Jack of Diamonds
Queen of Diamonds
4 of Hearts
3 of Clubs
10 of Diamonds
Ace of Spades
Ace of Hearts
3 of Hearts
5 of Clubs
8 of Spades
3 of Diamonds
King of Clubs
King of Spades
Deck Remaining 24
Poker Hand !
10 of Spades
2 of Hearts
Ace of Diamonds
Jack of Spades
King of Hearts
Deck Remaining 19

Leave a Comment

Your email address will not be published. Required fields are marked *