Sun Tzu wrote:Good start. Try this on takeCard() method:
If you understand why the code works, great. If not, keep trying.
Advice: you might want to use a set instead of a list, so that you will have no repeats. This will require more code on Card class, but will make code more robust.
An ArrayList will do (if you're careful), but try to figure out if how to implement this app using a Set<Card> to hold your deck of cards.
Hope this helps.
peace.
Thanks SunTzu, this is what I was looking for. Just to clarify for other people. Whenever I use code from coderanch.com I always give credit in the source using
java doc. I don't steal code and pass it off as my own. Tzu you gave me the answer which is what I needed so that I can study the code and learn from it. Thanks for answering my question.
@Hunter, we manually create a couple cards and add it to the deck. This is an intro programming class so we are taking it one step at a time. Thanks for the tip tho.
Thanks to everyone else who replied as well. Much appreciated.