1
Reply

Problem with blackjack

michael vergotis

michael vergotis

Oct 19 2010 4:35 AM
7.3k
Hi, I am making a blackjack game for an assignment.

The classes were given to us so they are all correct. 
I am struggling with 2 parts.
1. searching for ace and asking if they want a 1 or 11
2. displaying the points of each hand

In the class the code for the cards facevalue is 

public enum FaceValue {
Two , Three , Four , Five , Six , Seven , Eight ,
Nine , Ten , Jack , Queen , King , Ace 
I know i need to give them a number value also.Below is the code that deals two cards to the player and dealer and shows them to the screen. However i think i need to implement a switch statement to make the facevalues return a number instead of a word.
can anyone advise how and where to do this. 


public TwentyOne() {
            hands[PLAYER] = new ArrayList();
            hands[DEALER] = new ArrayList();
        

        /// <summary>
        /// Plays Twenty-one
        /// </summary>
        /// 

        public void Play() {
            
            

            pack.Shuffle();

            hands[PLAYER].AddRange(pack.DealTwoCards());
            hands[DEALER].AddRange(pack.DealTwoCards());
            DisplayHand(hands[PLAYER], "Player");
            

            DisplayHand(hands[DEALER], "Dealer");
i apologise if i have done something incorrectly as i am new to this forum.

Answers (1)