Homework 5

Learning Objectives

In this homework, you will apply the concepts you learned in class to reinforce your understanding of:

Description

In class we've explored the implementation of a simple terminal based Black Jack application. This implementation is missing a few features:

  1. Dealer hits on 16, stands on 17
  2. Ace can be treated as 1 or 11 (currently, ace is always 11)
  3. User must ‘stand’ on 21 (currently, the user has the ability to ‘hit’ even if his/her hand adds up to exactly 21).

Implement the features

For this homework, you must implement the features listed above and provide unit tests for features 1 and 2. You are welcome to add new methods to the existing classes, however:

[2020-02-16] IMPORTANT UPDATE: I updated the method signature of the play() method contained in Dealer.java. It is now:
void play(Deck d)

Here is the link to the JavaDoc documentation of the provided classes.

Unit test your code

In addition to implementing the features, you must provide unit tests for your implementation of features 1 and 2. Name the classes that implement unit test after the class being tested: if the class being tested is named A, then the class containing unit tests for A must be named ATest.

Document the design

Create a UML class diagram specifying the dependencies between various classes of this application. You can create a digital version of your diagram using a tool of your choice (I use draw.io). You are welcome to hand draw the diagram, but make sure it is readable and clean (don't scratch things out on the final draft of your diagram).

Submitting your solution

Submit all the code necessry for the BlackJack application and unit tests to hw5 directory of your git repos. Submit a paper copy of your UML diagram in class.

Grading

All submitted code must compile. Code that does not compile will receive a grade of zero. I will be compiling your submissions with the following command:
javac Driver.java

I will use the list of questions below. Each question can score you from 0 to 2 points: No - 0, Somewhat - 1, Yes - 2. The sum of these points will be your grade for this homework.

  1. Did you implement the required features? (2 points per feature)
  2. Did you follow single responsibility principle in your implementation?
  3. Did you successfully unit test the code you added/modified? (2 points per feature)
  4. Did you successfully create a UML class diagram of this application