• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Dealing with cards in a deck

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the following code and what I want to figure out is when I deal out the card and face them down I want to take the top card and show its value and suit. I already know how to deal the cards to the players and flip the cards. Just need help/advice on showing that card.


Here is deck class


Here is card class


Here is where my problem is
 
Sheriff
Posts: 17644
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The player's cards are in the hand array right? Which element of that array represents the top card? Then doesn't a card have a toString() method?

Why are you doing this in the Player constructor?

This code is saying "The player will initially have a hand with 26 blank Cards".

Did you really mean to do that? If this were a real card game and you dealt me a hand with 26 blank cards, I'd be all

Lastly, while it's admirable that you are trying to write JavaDocs, you should read this document: http://www.oracle.com/technetwork/articles/java/index-137868.html so you know how to write them properly. When it comes to JavaDocs, you should conform to the conventions given in that document and yours don't.
 
I can't beleive you just said that. Now I need to calm down with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic