Question: Objectives: 1) Use of static variables; 2) Using multiple classes; 3) Operator overloading; 4) Overloading ostream; 5) Using friend functions. Project description: Write a C++

Objectives: 1) Use of static variables; 2) Using multiple classes; 3) Operator overloading; 4) Overloading ostream; 5) Using friend functions. Project description: Write a C++ program to simulate a simple card game between two players. The game should proceed as follows: The 52 cards in a deck of cards are shuffled and each player draws three cards from the top of the deck. The remaining cards are placed in a pile face-down between the two players. Players then select one of the three cards in hand and simultaneously place the chosen card face-up on the game table. The player who places the highest ranking card on the table collects both cards and adds them to their pile (score). If both cards have the same value the hand is a draw and no points are accumulated. Following the completion of a hand, each player draws the top card from the deck to add to their hand. Play continues until all cards have been played. The winner is the player with the most points at games end. You will use a standard deck of 52 cards where there are thirteen cards from each of four suits: hearts, spades, diamonds, and clubs. The thirteen cards in point order are the 2-10 numbered cards, the face cards (Jack, Queen, King), and the Ace card. Points are distributed as follows: Ace=15, face cards=10, all other cards count as their numeric value. Requirements: 1. Your program must be split into 7 files. There will be 3 classes (each with separate interface and implementation files), and a driver file. The requirements for these are specified below: a) The Card class This class represents an individual card Files must be named card.h and card.cpp Class must be named Card The interface (header file) is provided. i. You should implement the interface file in a .cpp implementation file ii. All data members must be of the type specified in the header file iii. All member functions in the interface file must be implemented as declared However you have flexibility in how you choose to implement each b) The Deck class This is represents the deck of cards Files must be named deck.h and deck.cpp Class must be named Deck The interface (header file) is provided. i. You should implement the interface file in a .cpp implementation file ii. All data members must be of the type specified in the header file iii. All member functions in the interface file must be implemented as declared However you have flexibility in how you choose to implement each c) The Player class This class will represent the human and computer player Play is autonomous Files must be named player.h and player.cpp Class must be named Player The interface (header file) is provided. i. You should implement the interface file in a .cpp implementation file ii. All data members must be of the type specified in the header file iii. All member functions in the interface file must be implemented as declared However you have flexibility in how you choose to implement each c) A driver, or client, file Must be named proj4.cpp Must contain the line srand(1000); as the first line of the main function Must instantiate the card deck and the players, and control the game play, printing out the hand, scores, outcome (winner, loser, draw), and final winner and score as shown in the sample output. Output for this program must clearly and neatly show that the program works and that it works correctly. Your output should: 1. Display the entire deck of cards at the beginning of the game, and after it has been shuffled 2. For each hand, show the cards and score of each player before the play, the card each player plays, and the cards and score of each player after the play (but before the next card is drawn) 3. At the end show the winner of the game and the winning score. Below is a sample output of a games start and some late game hands as the game ends

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 Databases Questions!