|
my updated DealerHand (easier to read)
mport java.util.Random;
import java.util.Scanner;
public class DealerHand
{
protected int numberOfPoints; //Points in the hand
public DealerHand()
{
numberOfPoints = 0;
}
public void dealCards(CardDeck deck)
{
while(numberOfPoints < 17){
PlayingCard pc = deck.topCard();
int rank = pc.getRank();
switch(rank){
case 1: //Ace
numberOfPoints += 11;
break;
case 13: //King
case 12: //Queen
case 11: //Jack
numberOfPoints += 10;
break;
default: //the rest of cards
numberOfPoints += rank;
break;
}
}
}
public int handTotal()
{
return numberOfPoints;
}
}
|