Question: This assignment will use a Card class to build a Deck class. Then you will use the Deck class to play a card game called

This assignment will use a Card class to build a Deck class. Then you will use the Deck class to play a card game called One Card WAR.This is a simple game for 2 players. One card is dealt to each player, face up. The highest value card wins. If the cards are the same, then its a tie. Announce the winner Game over. You will allow the user to select how many games to play. If the number of requested games is greater that the number of cards in the deck, your Deck class will raise an exception and the main function will catch and resolve the exception. The exception will be raised in the deal() function. Also this program will be in a single file there will not be separate header and .cpp files for the classes. Also you will use a vector to store your cards in the Deck class DO NOT use an array to store the Cards in the Deck. You will have 2 classes:1) The Deck class which will create the deck of 52 cards2) The Card class which creates cards The main logic of the game will be in the main program. You will use the Card class and the Deck class to play the game. Here are the class descriptions for each class. Use these classes and only these functions. class DeckDeck()// constructor which creates a deck of 52 cardsCard deal()// deal a card if you can otherwise raise an exceptionvoid print()// show all the cards in the deckvoid shuffle()// shuffle the cards in the deckbool isEmpty()// return true if deck is emptyclass Card (notice there is NOT a default card constructorCard(char , char )// constructor to create a card, setting the suit and rankvoid print()// display the card example: AC,10S, KDint compare(Card)// return 1 for win, 0 for tie, -1 for lose

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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!