The Card Game Assignment - by John K. Estell
Home
Summary Information | Demonstration Applets | Source Code | Documents
jack of clubs

 

Summary Information

Summary: Write a Java program that implements a card game using the supplied card images. Requires use of ArrayList and other portions of the Collections Framework for organizing and manipulating cards, and Swing components for displaying card images. Focuses on developing the reusable classes Card, Deck, Hand, Rank, and Suit.
Topics: Common to all implementations: GUI design, event handling, list manipulation, inheritance. Other implementations can include GUI component manipulation.
Audience: Appropriate for CS2 or first GUI-intensive course that follows.
Strengths: Most students are familiar with some type of card game. Data structures for representing decks and hands of cards can be formed from ArrayList from the Collections Framework; this allows students to perform the needed list manipulations for their game without having to write sorting, searching, or shuffling algorithms. Use of Swing components allows for easy display of the card images by using JLabels and setting the appropriate card image as its icon. First part of the assignment leads students through the code development process. Use of Javadoc provides a "class implementation contract" that spells out the details for the code to be written.
Weaknesses: In their enthusiasm, students can seriously underestimate the amount of time needed to implement their specific card game when pursuing extra credit options. Instructor needs to interact early with the students to discern their intentions and provide appropriate guidance.
Dependencies: Requires a working understanding about Swing GUI components, event handling, and use of lists under the Collections Framework.
Variants: Some of the programs implemented so far include Draw Poker (both with and without betting), Rummy, Hearts, Blackjack, and several variations of Solitaire (e.g. Klondike, Four Corners).

Contact Information

John K. Estell
Electrical & Computer Engineering and Computer Science Department
Ohio Northern University
Ada, Ohio 45810
j-estell@onu.edu


Last updated 26 February 2004 by John K. Estell

four of hearts
seven of spades
queen of diamonds
ace of spades