CSCI3110 Lab3: Object-oriented Programming Solved

30.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: zip solution files instantly, after Payment

Securely Powered by: Secure Checkout

Description

5/5 - (1 vote)

PURPOSE:

  • learn to work with multiple classes
  • review operator overloading
  • review friends

 

Description:

Write a C++ program to play simple card game between you and the computer.  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 placed the highest ranking card on the table retrieves both cards and sets the cards aside.  If both cards have the same rank, each player retrieves his/her card and sets the one card aside.  Then, each player selects the top card from the deck (and adds this card to his/her hand of cards.  Play continues until all cards have been played.  The winner is the player with the most points at the end of the game.

 

We will use a standard deck of 52 cards where there are thirteen cards from each of four suites including hearts, spades, diamonds and clubs.  The thirteen cards in order by rank include the 2-10 cards followed by face cards (Jack, Queen, King) and the Ace card.  Points are distributed as follows:  Ace=15, face cards=10, all other cards count as the numeric value indicates.

 

Requirements

  • You are required to use C++ classes for this program. You should have a “deck” class, a “player” class and a “card” class. Header files for these classes are provided by the instructor. It is not necessary to modify the provided header files.

 

  • Output for this program must clearly and neatly show that the program does work and that it works correctly. Your output should:
    • display the entire deck of cards at the beginning of the game, and after shuffle

 

  • For each play, 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:

 

  • Show the winner of the game.

 

A sample executable file is provided by the instructor. You can run the program and check the sample output formats.

 

Hint:

Use the following statements to print suit symbols:

cout << ((char)0x03); //print Heart symbol   cout << ((char)0x04); //print Diamond symbol     cout << ((char)0x05); //print Club symbol   cout << ((char)0x06); //print Spade symbol

 

How to download assignment files:

Go to the URL: http://www.cs.mtsu.edu/~zdong/3110/public/OLA/ and download the file OLA3.zip, which contains the following files:

  • doc: this file
  • doc: a rubric used to grade this assignment • OLA3.exe: an executable solution provided by the instructor.
  • h: the header for the class Card.
  • h: the header for the class Player. • Deck.h: the header for the class Deck.

 

  • CardGame.zip