Purchase Solution

Write Card, Deck and Player Classes in C++

Not what you're looking for?

Ask Custom Question

1. Write a class called "Card" with the following traits: it holds two private variables, a suit and a value (ace is high). It has public functions that randomly generate and modify the suit, value and print out the suit/value to the screen. Write a suitable main function to test that it is working properly.

2. Write a class called "Deck" with the following traits: it holds an array that keeps track of all of the cards in the deck, it has functions like that shuffles the deck (randomly arranges the array with a list of cards), reports how many cards are currently in the deck, allows a card to be "drawn" from the deck (gives the next card in the array and marks it as used; this will return a value that is of type Card). Write a suitable main function to test if this is working properly.

3. Write a class called "Player" with the following traits: it holds an array of five "Cards" (from above), a player name, current points/money. It should have functions that will set and report the player name, set the starting balance of points, add/subtract points as necessary, compare two cards to see if they are the same, "draw" five random cards from the deck and store the draw into the array (making sure that no duplicates exist), print out the hand to the screen, ask the user to discard a specific number of cards (and select them) and replace the discarded cards with new ones. Write a suitable main function to test that it is working properly.

Purchase this Solution

Solution Summary

This solution provides a detailed discussion of the given programming languages problem.

Purchase this Solution


Free BrainMass Quizzes
Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

C# variables and classes

This quiz contains questions about C# classes and variables.

Basic Networking Questions

This quiz consists of some basic networking questions.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Javscript Basics

Quiz on basics of javascript programming language.