CIS300 Spring 2005: Assignment 1
7 points; due Tuesday, 25 January, at 10:00pm

You must write an application that acts like a dealer of playing cards: it gives cards to the user as requested, adding them to the user's ``hand,'' and it discards cards from the user's hand, if the user requests.

Specification

Here is a sequence of use-cases that show the application's behavior:

(i) start the program: the display shows my hand, [ ]. (It's empty.)
(ii) ask for a card: the display shows my updated hand, say, [4 of hearts]
(iii) ask for a card: the display shows [4 of hearts; queen of diamonds]
(iv) ask for a card: the display shows [4 of hearts; queen of diamonds; ace of clubs]
(v) ask to discard the second card in my hand: the display shows [4 of hearts; ace of clubs] (Note: Or, one might ask to discard the first or third card....)
(vi) ask for a card: the display shows [4 of hearts; ace of clubs; 2 of clubs]
(vii) ask to start over: the display shows [ ]
(viii) ask for a card: the display shows [9 of spades].

The interactions continue like this until the user terminates the program.

Design

The application should be implemented as a Model-View-Controller architecture, where the Model contains the data structure for the user's hand of cards. You may use a prewritten package, package PlayingCards, which implements cards and a deck of cards. (You use the package to construct a deck of cards and ``deal'' from the deck into the user's hand of cards.) Here is picture of the design:

The Controller holds the algorithm, which loops to receive, process, and display the results of the user's commands. The View consists of dialogs, frames, System.out, etc., that you choose for input and output. (Note: whatever input format you choose, please ensure that input interface is labelled well enough that the user can enter commands without first reading a User's Manual.) The Model consists of the class, HandOfCards, that you write plus the contents of package PlayingCards.

Implementation

You must construct a package named Dealer, where you place your classes for the Model, the Controller, and the View. You may download package PlayingCards at http://www.cis.ksu.edu/~schmidt/300s05/Assign/Assn1 and copy it to the same folder where you created package Dealer. Important: you must not alter package PlayingCards; the classes in package Dealer must import PlayingCards to use it.

package Dealer must contain a class Start (the Controller), which itself contains a method main. The application is started via Dealer.Start.

The two packages, Dealer and PayingCards, are placed within a folder named Assign1. Read the section named ``Java Packages'' in the lecture, ``Software development in Java: classes, objects, and packages,'' for the technical details. (If you are a BlueJ user, you might wish to read the document at http://www.cis.ksu.edu/~schmidt/300s05/bluej.packages.html)

Build and test your work in the above configuration. Remember to insert javadoc-style commentary into your work. When you are satisfied with the results, execute javadoc to generate the web documentation.

What to Submit

Use the automated submission page at http://www.cis.ksu.edu/~schmidt/300s05/Assign/submit.html to submit a jar-file of your work. Here's how you should prepare the jar file:

  1. Ensure that you have created a folder, named Assign1, and have placed packages Dealer and PlayingCards within it. Ensure that all the files in both packages are compiled and are ready for immediate testing.
  2. Enter (open) the Assign1 folder. Use javadoc to generate the web documentation for the Library package you wrote: Execute javadoc -classpath . Library. (Or, use BlueJ to do this.)
  3. Leave (close) the Assign1 folder. Now, create a jar-file, Assign1.jar, from Assign1, by typing this command in a command window:
    jar c Assign1 > Assign1.jar
    
    (A jar-file is Java's version of a ``zip'' file; it holds one entire folder in a single file.) See the instructions at http://www.cis.ksu.edu/~schmidt/300s05/Assign/how.to.jar.html for details.
  4. Go to http://www.cis.ksu.edu/~schmidt/300s05/Assign/submit.html and follow the instructions there. Submit your jar-file before the deadline.