Nick Arauza

Greenhorn
+ Follow
since May 13, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Nick Arauza

Alright I changed my code up quite a bit, I think I' am heading in the right direction, but I get an error message saying
"non static variable rank cannot be referenced from a static context." This occurs when the value of rank is checked. My teacher suggested I use if else statements to assign points to the dealer based on the rank of a card. I'm not sure how to get around this error.

Here is what I have:


also, before this can work, I'm not sure how to call the method dealCard() from the dealerhand class. dealCard() is in class CardDeck and looks like this:



I'm a little confused right now, so I dont know if I have given enough info for you guys to help me out, if so just let me know. Thanks again.
14 years ago
thanks, but I still need help with this matter.
14 years ago
Hello all

I've noticed that this game is done quite often by people and now it's one of my assignments. It was split into two parts, the first assignment being to create a deck of cards as an array and assign an image of each card to the corresponding suit and rank, then methods that shuffle and deal these cards.

The second assignment is the actual Blackjack game, and now I' am completely stuck. In my program I need to have a separate class for the player and dealer but I'm stuck on the dealer class. I have to initialize field numberOfPoints to 0 with a constructor, then the method deal should call the method dealCard() of class CardDeck in a loop, adding the value of each resulting card to the current value of numberOfPoints. Use the object returned by method dealCard() to call method drawCard of class PlayingCard, in order to display a picture of the card on screen. The loop terminates when value of the field numberOfPoints reaches 17 or higher. Also for simplicity, Im always to count Ace as 11 points for the dealer's hand. Lastly method handTotal() returns the value of field numberOfPoints.



Now I'm not sure how to go about implementing the loop, as it says that the cards drawn should add up, but the array of cards contained actual file images of the cards themselves so how do they have a value?

Thanks in advance.
14 years ago