/** * This class will hold instances of 2 cards. * * @author Devin Gray and Class * @version 2/19/2016 */ public class Hand { private Card card1; private Card card2; private boolean aceFlag = false; public Hand() { } public void addFirstCard(Card card1) { this.card1 = card1; if(card1.getValue() == 11) { this.aceFlag = true; } } public void addSecondCard(Card card2) { this.card2 = card2; if(card2.getValue() == 11) { this.aceFlag = true; } } /** * A dealer will "Hit" if the initial two cards either * (1) total 16 or less or * (2) make a soft 17. -- TODO * Otherwise, the dealer will "Stand". */ public void evaluate() { int handValue = card1.getValue() + card2.getValue(); if(handValue <= 16 || (handValue == 17 && aceFlag)) { System.out.println("Hit"); } else { System.out.println("Stand"); } } }