Last revised 7/11/01 11:30pm.

CSC 224 -- Project 3

Part A: Currency   100 Points

Goal: Create a currency converter with a user interface similar to the following.

You can use the GridLayout layout manager instead of FlowLayout for better placement of the controls.

Look up the current exchange rates in the newspaper and hardcode them into your program. When the Submit button is clicked, do the following. Take the currency value in the textbox with its radio button checked and write the corresponding converted concurrency values into the other textboxes.

 

Part B: Dealer   150 Points

Goal:   Create a command line application that shuffles a deck of cards and deals it into hands of specified sizes. There are four classes: Card, Stack, Deck, and Hand. Here is a diagram showing the relationships between the classes. A dotted arrow indicates an "is used by" relationship; a solid line indicates an "inherits" relationship. Unfortunately, the dotted arrows are pointing in the wrong direction for a "uses" relationship. I don't know if I will get these reversed before you finish the project.

Class Card

Instance variables

Constructor

Methods

 

Class Stack

Uses Card.

Instance variables

Constructor

Methods

Class Deck

Inherits Stack.   Uses Card, Stack.

Instance variables

Constructor

Methods

Class Hand

Inherits Stack.   Uses Card.

Instance variables

Constructor

Methods

Sample Main Method.

The following code deals out four 13 card bridge hands and prints them. Test your classes with it.
public static void main(String[] args)
{
    final int TIMES_TO_SHUFFLE = 5;
    final int CARDS_PER_HAND = 13;
    int i;

    Deck deck = new Deck();
    Hand north = new Hand(13);
    Hand east = new Hand(13);
    Hand south = new Hand(13);
    Hand west = new Hand(13);

    for(i = 1; i <= TIMES_TO_SHUFFLE; i++)
       deck.shuffle();

    for(i = 1; i <= CARDS_PER_HAND; i++)
    {
       deck.deal(west);
       deck.deal(north);
       deck.deal(east);
       deck.deal(south);
    }

    west.displayUnsorted();
    north.displayUnsorted();
    east.displayUnsorted();
    south.displayUnsorted();

    west.displaySorted();
    north.displaySorted();
    east.displaySorted();
    south.displaySorted();
}