Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

War (C++ Program). (Don't just copy and paste. I need the functions to be exactly like the one provided below on the classes. ) Note:

War (C++ Program). (Don't just copy and paste. I need the functions to be exactly like the one provided below on the classes. )

Note: This program will also need to display the actual cards just like the sample below.

Classes:

1)The Deck class which will create the deck of cards Deck.h , Deck.cpp

2)The Card class which creates cards Card.h , Card.cpp

The main logic of the program will be in the main class. You will use the Card class and the CardDeck class to play the game.

Here the methods you will need to build. Feel free to add more if you need them.

public class CardDeck

public Deck( // constructor which creates a deck of 52 cards

public void resetDeck // resets the deck so it looks like a new deck.

public Card deal( ) // deal a card

public int cardsLeft( ) // return the number of cards left in the deck.

public void shuffle( ) // shuffle the cards in the deck

public displayDeck// show all the cards in the deck.

public class Card

public Card(); // Creates a blank card.

public Card (char s, char r ) // constructor to create a card, setting the suit and rank

public void setCard(char s, char r); // a method to set an existing blank card to a particular value

public int getValue( ) // return the point value of the card. Ace = 1, 2 thru 10, face cards = 10

public void displayCard( ) // method to display the card

Sample output.

image text in transcribed

You will need to provide a menu with the following choices:

1)Get a new card deck

2)Show all the cards that reamin in the deck

3)Shuffle

4)Play WAR!

5)Exit

There are 52 cards in the deck. . . .dealing. . . . One for you. . . Two ofDiamonds [2 2] One for me... Ace of Hearts You Win!!!! Wanna play again? (yes There are 50 cards in the deck. . . .dealing. . . . One for you. . . Queen of Spades

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

How Do I Use A Database Research Tools You Can Use

Authors: Laura La Bella

1st Edition

1622753763, 978-1622753765

More Books

Students also viewed these Databases questions

Question

7. Where Do We Begin?

Answered: 1 week ago