This preview shows page 1. Sign up to view the full content.
Unformatted text preview: int cardVal; // The blackjack value of the ith card. card = get±ard(i); cardVal = card.getValue(); // The normal value, 1 to 13. if (cardVal > 10) { cardVal = 10; // For a Jack, Queen, or King. } if (cardVal == 1) { ace = true; // There is at least one ace. } val = val + cardVal; } // Now, val is the value of the hand, counting any ace as 1. // If there is an ace, and if changing its value from 1 to // 11 would leave the score less than or equal to 21, // then do so by adding the extra 10 points to val. if ( ace == true && val + 10 <= 21 ) val = val + 10; return val; } // end getBlackjackValue() } // end class BlackjackHand }...
View
Full
Document
This note was uploaded on 01/15/2010 for the course CSC 115 taught by Professor Jackson during the Spring '09 term at University of Victoria.
 Spring '09
 jackson

Click to edit the document details