CBIS 4210 Project 4

For Project 4,  you will write, compile, and run a program that deals a random hand of cards to a user. You will have two classes: Card, the class that represents a single card; and CardTest, the driver program that tests the Card class by dealing five random cards.

At the top of each of your files, include the following lines of comments:

// ClassName.java
// by Your Name
// Project 4 - Due Date

Save all project files in a folder on your floppy called A:\4210\proj4\proj4_xxx\ (where xxx are your first, middle, & last initials). Compile all files on your disk in the project folder for grading.

Program Requirements:

  • The Card class generates a random card number between 0 and 51 (a standard 52-card deck):
    • The card number is an instance field, and is generated when the Card() default constructor is called
    • Card has two private String arrays: faces[13] for the 13 card face names {"Ace", "Two",..."King"}, and suits[4] for the 4 card suit names {"Clubs", "Diamonds", "Hearts", "Spades"}
    • Card has three methods: getCardNum(), getFace(), and getSuit(). getCardNum() returns the card's number (0-51); getFace() returns the appropriate face name (the faces array subscript card number mod 13); getSuit() returns the appropriate card suit name from the suit array (subscript: cardNumber/13)
  • The CardTest program should instantiate five cards (you may use an array like myCards[0]... myCards[4]), and print them to the screen in a message dialog box.
  • Javadoc comments for all methods and fields in the Card class. Run Javadoc on the Card class before handing in your disk.

Due: Tuesday, October 19, at the beginning of class.

[Back to Calendar]