Project #5
Due 9am Wednesday, February 20, 2002
Programming projects 4.3 (p218) and 6.8 (p317).
For this project you need to implement the classes for Card and
DeckOfCards as described in the textbook questions.
Note that the shuffle method should rearrange the cards in the deck
-- do not try to generate random cards here, because you will get duplicates!
It is easier (and more realistic) to have two methods:
- shuffle(): interleaves first half of deck with second half
- cut(): cuts the deck at a random position and puts the second stack before the first stack.
The driver class should contain a main method that:
- instantiates a deck of cards
- prints out all the cards in the deck
- shuffles it once
- prints out the deck again
- cuts
- prints out the deck again
- does a series of 10 shuffles and cuts (shuffle, cut, shuffle cut, etc.)
- prints out the deck again
- Deals the cards from the shuffled deck, printing out:
- each card as it is dealt
- the number of remaining cards in the deck
If you want to be more creative and/or ambitious, you can have the program
then go on to do something else. Please bear in mind that:
- The program should first do what is required
- It should require no input from the user
- It should run in a single window as a stand-alone application
Enhanced versions, including applets, are also welcome, but they should
be submitted on a floppy (not by email) and they should be in addition to
(not instead of) the normal (text) version that is required.
Note that you should develop your program in three files, but please then
combine them into a single file DealCards.java so that it can
be submitted (and collected) in one step.
Note that when you combine the class declarations into a single file,
the class that contains the main method should be public
(in this case this class has to be called DealCards
to match the filename);
all other classes should no longer have public visibility.
Be sure to test it well.
Your program must be well documented and formatted and please remember to
put some extra comments and blank lines at the beginning and end of the file,
so as to avoid the submission problems that we experienced in the past.