Assignment #4: Classes for Part I

From our design work in class we decided that the Blackjack program should have three classes - one to represent a Card, one to represent a Blackjack hand, and one to represent a Player. For Part I you need to complete the Card class, the Hand class, and the Player class and write a driver program to play a game between the dealer and a person. In developing your classes it would be wise to have a test program that tests each method as you write a class.

Card class: This class represents a playing card. A card has two attributes - a suit and a rank. Hence, the Card class should have two instance variables:

Provide the following public methods:

Hand class: This class represents a Blackjack hand. It should have at least the following instance data:

Some of the methods the Hand class needs (add others if needed):

Player class: This class simulates a Blackjack player. For now the player is one of two types - the dealer or a person. In part II we'll add the capability of the player being the computer. The player should have the following instance data:

The methods the class should provide include:

With these classes the main class that plays the game will be fairly simple (all the work is in the classes). It needs to instantiate two Player objects - a dealer and a person (it should read in the person's name). Then it will play according to the rules of the game checking to see who won.