CPSC 120 Assignment #4
Five-card Draw
Friday December 4, 2009 by 4 p.m.

In this assignment you will write a program that plays a variation of the poker game called five-card draw. The main idea of five-card draw is to get a hand of five cards with the highest rank. We will use the following ranks (from highest to lowest):

The game proceeds as follows:

Your program will play the game between a human player and a dealer. It should ask for the name of the player, then have a loop that lets the player keep playing games against the dealer. It should clearly indicate what is happening as the game is played. The player should go first. When it is the dealer's turn if the dealer's rank is nothing, it should swap the two lowest valued cards.

Sample output:

     Welcome to the Casino!

Please enter the player's name: Bozo

Dealing Bozo's hand...
Bozo's cards are: 3♦ A♥ 8♣ 5♠ Q♥

Dealing Dealer's hand...

Bozo's turn...
Please enter the number of cards to exchange (0 - 2): 2
Please enter the index of a card to exchange (0 - 4): 0
Please enter the index of a card to exchange (0 - 4): 3

Bozo's cards are: 10♣ A♥ 8♣ A♠ Q♥

Dealer's turn...
Dealer's cards are: 2♥ 3♣ K♣ J♦ 8♠

Dealer exchanges 2 cards...
Dealer's cards are: 8♦ 9♥ K♣ J♦ 8♠

Bozo wins!

Please enter y to play again: n

Additional requirements:

Grading Your program will be graded both on style and correctness. Style includes adherence to rules for naming of identifiers and use of white space; it also includes coding style such as the absence of unnecessary code (extra comparisons in if's or extra assignments); it includes good class design (appropriate choice of instance variables and methods); it includes appropriate documentation. Style will be 20% of the grade on the assignment. Correctness includes meeting all the specifications of the assignment. A program that does not compile has an automatic deduction of 70% no matter how "close" it is to compiling or running. Come see me if you have problems with the assignment. It is important that you get in the habit of producing correct programs!

Academic Integrity Reminder!!! Programming assignments are to be your own work. You may get help on the specifics of the assignment from no one except the instructor. You may not show your program to anyone or look at anyone else's program or share ideas with anyone about how to write the program.

Submission: cp a tgz file (with your name as the file name) that contains the java files for your program to the directory: