Assignment #4: Classes

From our design work in class we decided that the poker program should have three classes - one to represent a card, one to represent a hand of cards, and one to represent a deck of cards. For the assignment you need to complete the Card class, the Hand class, and the Deck 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 the following instance data:

Some of the methods the Hand class needs (add others if needed): The following private methods will make the getRank() method easier to write:

Deck class: This class represents a deck of playing cards. It should have the following instance data:

The methods the class should provide include: