Question: Instructions: Create a program to shuffle and deal with a deck of cards. The program should consist of a class Card, classDeckOfCards, and the main
Instructions: Create a program to shuffle and deal with a deck of cards. The program should consist of a class Card, classDeckOfCards, and the main program. Class Card should provide:Private data member's face and suit of type int.A constructor that receives two ints representing the face and suit and uses them to initialize the data members.Two private static arrays of strings representing the faces and suits. (Face would be 2through 10 and Jack, Queen, King, and Ace. The suit would be Diamonds, Hearts, Clubs, and Spades.)A listing of DeckOfCards as a friend of Card. Class DeckOfCards should contain:Aprivate a data member named deck that is an array of Cards.Aprivate int data member namedcurrentCardrepresenting the index of the next Card to deal.A default constructor that initializes the Cards in the deck.A shuffle function that shuffles the cards in the deck. The shuffle algorithm should iterate through the array of Cards. For each Card, randomly select another Card in the deck and swap the two Cards.A dealCardfunction that returns a string representation of the next Card object from the deck. The string should be in the form of face of suit.You can use the + operator to concatenate strings. This function throws an exception if the deck is empty. The main program should create a deck of cards object, shuffle the cards, then deal the cards until it catches the exception indicating that there are no more cards to deal with. Do not write an infinite loop. Instead, exit gracefully using a Boolean flag.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
