Create a class to model a single playing card in a deck of cards and name this
Fantastic news! We've Found the answer you've been seeking!
Question:
•Create a class to model a single playing card in a deck of cards and name this class Card.
•The class should include data members for rank and suit.
•Use integers to identify rank and strings to identify suit.
•Include an explicit constructor that receives a rank and suit value.
•Include setter/getter member methods for each data member.
•Include a toString() member method that returns a string showing the rank and suit of the card.
•Test this class by instantiating Card objects. Construct a deck of cards as an array and fill it with 52 cards in a complete playing deck.
•Shuffle the deck and deal 5 cards, displaying the rank and suit of each card dealt.
Related Book For
Probability and Random Processes With Applications to Signal Processing and Communications
ISBN: 978-0123869814
2nd edition
Authors: Scott Miller, Donald Childers
Posted Date: