Fall 2016, David Matuszek

- To get you started programming in Java.
- To get you started with the Eclipse IDE (Integrated Development Environment).

This is a simplified version of a common card game, "21". Blackjack is a better-known variant.

In this game, the dealer deals two "cards" to each player, one hidden,
so that only the player who gets it knows what it is, and one face up, so
that everyone can see it. (Actually, what the other players see is the *total*
of each other player's cards, not the individual cards.)

The players then take turns requesting cards, trying to get as close to 21 as possible, but not going over 21. A player may pass (ask for no more cards). Once a player has passed, he or she cannot later ask for another card. When all players have passed, the game ends.

The winner is the player who has come closest to 21 without exceeding it. In the case of a tie, or if everyone goes over 21, no one wins.

Simplifications:

- The game is only played once (so it's actually just one "hand").
- "Cards" are the numbers 1 through 10.
- There is nothing special about the "Ace" or about any other card.
- Cards are randomly generated, not drawn from a deck of limited size.

I am providing you with a "skeleton" of the game; all the classes and methods have been defined, but most of the actual code has been deleted. Your task is to finish the program by adding the necessary code. Javadoc-style comments (included) tell you what must be done in each method.

- Simple21.zip contains the "skeleton"
source for the program (the
`Human`

class is complete). - doc.zip contains the generated Javadoc (start
reading with
`index.html`

).

Print out what the program is doing as it goes along. Here are some runs of my program; yours should provide the same information.

Welcome to the game of 21! What is your name? Dave Dave takes a hidden card. (It's a 10) Dave takes 8 Manny takes a hidden card. Manny takes 10 Moe takes a hidden card. Moe takes 10 Jack takes a hidden card. Jack takes 10 Take another card? n Dave passes. Manny passes. Moe takes 6 Jack takes 10 Moe passes. Jack passes. Game over. Dave has 18 points. Manny has 18 points. Moe has 17 points. Jack has 23 points. Nobody wins. |
Welcome to the game of 21! What is your name? Dave Dave takes a hidden card. (It's a 3) Dave takes 3 Manny takes a hidden card. Manny takes 6 Moe takes a hidden card. Moe takes 9 Jack takes a hidden card. Jack takes 7 Take another card? y Dave takes 6 Manny takes 1 Moe takes 6 Jack passes. Take another card? y Dave takes 4 Manny takes 6 Moe passes. Take another card? y Dave takes 5 Manny passes. Take another card? n Dave passes. Game over. Dave has 21 points. Manny has 19 points. Moe has 18 points. Jack has 17 points. Dave wins with 21 points! |
Welcome to the game of 21! What is your name? Dave Dave takes a hidden card. (It's a 4) Dave takes 9 Manny takes a hidden card. Manny takes 8 Moe takes a hidden card. Moe takes 8 Jack takes a hidden card. Jack takes 8 Take another card? y Dave takes 7 Manny passes. Moe takes 2 Jack takes 2 Take another card? n Dave passes. Moe passes. Jack takes 7 Jack passes. Game over. Dave has 20 points. Manny has 17 points. Moe has 18 points. Jack has 18 points. Dave wins with 20 points! |

It is definitely possible to complete this skeleton to make a working program; I created this assignment by writing the program, then removing the code from the methods. However, if you have trouble doing things exactly this way, you can make some changes in order to get your program to work. Just don't restructure the program any more than necessary, and make sure your comments agree with the program.

Zip your complete project and submit it to Canvas
by** 11:59pm Wednesday, November 9.**