June 2006
Intermediate to advanced
1344 pages
42h 52m
English
The examples in the chapter thus far have used arrays containing elements of primitive types. Recall from Section 8.2. that the elements of an array can be of either primitive types or reference types. This section uses random number generation and an array of reference-type elements, namely references to objects representing playing cards, to develop a class that simulates card shuffling and dealing. You can then use this class to implement applications that play specific card games.
First, we develop class Card (Fig. 8.8), which represents a playing card that has a face (e.g., "Ace", "Deuce", "Three",..., "Jack", "Queen", "King") and a suit (e.g., "Hearts", "Diamonds", "Clubs", "Spades" ...
Read now
Unlock full access