Results 1 to 2 of 2

Thread: Linked lists

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2007
    Posts
    12

    Linked lists

    Hi guys,

    I'm working on a Java-application, but really don't know where to start, and was hoping someone can help me out. This is the exercise:

    Write a class PlayCards which includes a redirection to a linked list with a set of gamecards.

    The constructor method of PlayCards generates, when initializing the application, a sorted stack of gamecards.

    Write a method to print the color and value of each card.

    Write a method to shuffle the game. Do this by splitting the the stack at a sudden point, and switch the first half with the second half. Repeat this several times.

    And this is as far as I can get:

    Public class Playcard{
    private String color;
    private String value;
    private Speelkaart nextcard;

    Playcard(String color, String value)
    {
    this.color=red;
    this.value= hearts;
    }

    public String getColor (){
    return color();
    }
    public String getvalue(){
    return value();
    }


    }

    Anyone wants to help out?

  2. #2
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: Linked lists

    1- I'm sure a card's value is the number written on it (int).
    2- You have no linked list in here. read about Linked lists before you dig into coding.
    3- As a hint use array of 52 cards (numbers) and use the number to initialize a card (every suit is 13 cards)
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width