View Single Post
  #3 (permalink)  
Old 12-08-2007, 01:31 AM
mandrake446 mandrake446 is offline
Member
 
Join Date: Nov 2007
Posts: 8
mandrake446 is on a distinguished road
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;
}
}
Reply With Quote