This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I'm trying to create a blackjack game and am trying to calculate the values but Ace = high or low is throwing me off. I can account for if there is 1 ace in the hand but if a second pops up my previous code couldn't handle that. I've tryed to adjust the code to use a for each loop but I can't get it working.
Below is what I have. Can anyone point me in the right direction?
This method has some hope....but it's not going to work. You're looping through the deck within a loop of the deck....so you're probably getting some crazy answers on this. You need to rethink this and think about all the possible cases. What will you do if you have 2 aces in one hand?
Maybe rephrasing that question will lead you in the right direction: If you knew after going through your hand that you had 2 aces, how would that affect your summation?
good luck. And remember: You'll learn more and get better responses if you post the results of executing your code.