CPSC 120 Assignment #4
Blackjack with Classes
Part I Due, Friday November 21, 2008 by 4 p.m.

In this assignment you will write a program that plays the game of Blackjack. The main idea of Blackjack is to get a hand of cards that adds up as close as possible to 21 without going over. We will use the following rules:

Your basic program for Part I of the assignment 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 (it must show the initial cards for the human player, it must display the "top" card for the dealer, and each time a player hits it should display the new card and the new point total).

Sample output:

     Welcome to the Blackjack Casino!

Please enter the player's name: Bozo

Dealing Bozo's hand...
Cards are 3 of Diamonds and 5 of Hearts
Count is 8

Dealing Dealer's hand...
Top card is 10 of Clubs

Bozo's turn...
Do you want to hit or stick (h or s)? h

New card is 6 of Clubs
Count is 14
Do you want to hit or stick (h or s)? h

New card is Ace of Spades
Count is 15

Do you want to hit or stick (h or s)? h

New card is 4 of Hearts
Count is 19

Do you want to hit or stick (h or s)? s 

Dealer's turn...
Bottom card is 4 of Diamonds
Count is 14

Dealer hits...

New card is 3 of Spades
Count is 17

Dealer sticks...

Bozo's count is 19
Dealer's count is 17

Bozo wins!

Play again?


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!

NOTE: Part II of the assignment will be to add the capability of the player being a computer.

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.

Hand IN: A printed copy of your program files. Tar your assign4 directory and email the tar file to your instructor.