Search:

Type: Posts; User: Norm

Search: Search took 0.11 seconds.

  1. Re: Trying to make a Risk game, but I got stuck on the Hand class.

    How do you test the code? I don't see a main() method.
  2. Re: Trying to make a Risk game, but I got stuck on the Hand class.

    Please post the current version of the code that shows what problem you are having.
  3. Re: Trying to make a Risk game, but I got stuck on the Hand class.

    That sounds like you need a loop to go through the contents of the ArrayList and count the number of times each item appears in the list.
  4. Re: Trying to make a Risk game, but I got stuck on the Hand class.

    What does that have to do with coding enum usage?
    Post#24 shows a way to use enums.
    Rewrite the code in post#23 to use that technique and show what you are trying to do.
    Add some comments to...
  5. Re: Trying to make a Risk game, but I got stuck on the Hand class.

    Where are the items that are being counted to see if there are three of a kind? Should there be three variables that the code tests the contents of to see if they match?
  6. Re: Trying to make a Risk game, but I got stuck on the Hand class.

    The enum is spelled: with A not a- Arms not arms.

    Why does the code try to compare an enum to an int?

    This code compiles:

    if(Arms.INFANTRY == arms){
  7. Re: Trying to make a Risk game, but I got stuck on the Hand class.

    I don't have any packages for testing forum code. That's why I'd like all the code in one file for testing.



    if(arm.INFANTRY == 3){
    arm is an array and does not have a field named:...
  8. Re: Trying to make a Risk game, but I got stuck on the Hand class.

    That code doesn't compile. These are its errors:
  9. Re: Trying to make a Risk game, but I got stuck on the Hand class.

    Where is the code that generates those error messages?

    Can you post a small, simple, complete program that shows the problem?
    Something that will compile when the problem is fixed.
  10. Re: Trying to make a Risk game, but I got stuck on the Hand class.

    Sorry, I'd prefer ONE file for testing, not two or three or whatever is needed.
    It shouldn't take over 20 lines of code.

    Also post the full text of the compiler's error message when you try to...
  11. Re: Trying to make a Risk game, but I got stuck on the Hand class.

    Can you post a small, simple, complete program that shows the problem?
    Something that will compile when the problem is fixed.
  12. Re: Trying to make a Risk game, but I got stuck on the Hand class.

    Did you try: Arms.INFANTRY
  13. Re: Trying to make a Risk game, but I got stuck on the Hand class.

    Try adding on the name of the enum.
  14. Re: Trying to make a Risk game, but I got stuck on the Hand class.

    If there are more than one card in the hand after removing 3 cards from deck, which card is it supposed to return?
  15. Re: Trying to make a Risk game, but I got stuck on the Hand class.

    public Card removeCardsFromHand(
    The method says that it is going to return an instance of the Card class.
    Is that what it is supposed to return?

    The code is trying to return an ArrayList. The...
  16. Re: Trying to make a Risk game, but I got stuck on the Hand class.

    The ArrayList class's remove() method is defined to take one int as its argument. The code is trying to call that method with 3 int values.
    Can the code be changed to call the remove() method...
Results 1 to 16 of 16