Results 1 to 7 of 7
Like Tree1Likes
  • 1 Post By Fubarable

Thread: Deck,shuffle, unwrap cards

  1. #1
    pots is offline Member
    Join Date
    Feb 2013
    Posts
    2
    Rep Power
    0

    Default Deck,shuffle, unwrap cards

    Write a program called “Project_BridgeDeal” that adds the methods required for the main method shown below. The objective is to initialize the deck, shuffle the deck, deal thirteen cards to each of four players, and display the hand dealt to each player sorted by suit and rank. The names of the four players are North, East, South, and West. You may use the code in Listing 6.2 in the text if you wish.

    1. These are the methods you need to add:
    • public static void unwrap(int[] pack) { // Initialize the deck
    • public static void shuffle(int[] pack) { // Shuffle the deck
    • public static int[] deal(int[] pack, int n, int offset) { // Deal “n” cards offset from the beginning of the deck. Return the hand dealt as an array of integers.
    • public static void showHand(int[] hand, String player) { // Show a player’s hand sorted by suit and rank. The name of the player is passed as a string.


    Sample output
    Here is a sample run of the program:

    North was dealt:
    2 of Spades
    6 of Spades
    8 of Spades
    2 of Hearts
    3 of Hearts
    8 of Hearts
    10 of Hearts
    6 of Diamonds
    8 of Diamonds
    Queen of Diamonds
    King of Diamonds
    4 of Clubs
    5 of Clubs

    East was dealt:
    5 of Spades
    King of Spades
    6 of Hearts
    9 of Hearts
    Jack of Hearts
    Queen of Hearts
    Ace of Hearts
    2 of Diamonds
    4 of Diamonds
    10 of Diamonds
    Ace of Diamonds
    9 of Clubs
    Jack of Clubs

    South was dealt:
    3 of Spades
    4 of Spades
    9 of Spades
    Jack of Spades
    Ace of Spades
    7 of Hearts
    3 of Diamonds
    5 of Diamonds
    7 of Diamonds
    Jack of Diamonds
    3 of Clubs
    7 of Clubs
    King of Clubs

    West was dealt:
    7 of Spades
    10 of Spades
    Queen of Spades
    4 of Hearts
    5 of Hearts
    King of Hearts
    9 of Diamonds
    2 of Clubs
    6 of Clubs
    8 of Clubs
    10 of Clubs
    Queen of Clubs
    Ace of Clubs


  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Deck,shuffle, unwrap cards

    Thank you for posting your assignment on this site. If you have an actual question, please ask it soon so that this thread doesn't get closed as a homework dump.

  3. #3
    pots is offline Member
    Join Date
    Feb 2013
    Posts
    2
    Rep Power
    0

    Default Re: Deck,shuffle, unwrap cards

    I am completely new to Java and programming, Can someone please help me to solve this.

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,091
    Rep Power
    20

    Default Re: Deck,shuffle, unwrap cards

    That's nice.
    Good luck.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,423
    Rep Power
    20

    Default Re: Deck,shuffle, unwrap cards

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  6. #6
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Deck,shuffle, unwrap cards

    We can help you but only if you ask a question. Please at least put in some effort and let us know exactly what confuses you. Don't simply dump your homework here and throw up your hands. Locking this but I invite you to come back if you have any specific questions to ask.
    pots likes this.

  7. #7
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. Tryin to create a deck of cards
    By mrbrendano in forum New To Java
    Replies: 6
    Last Post: 08-03-2011, 05:32 PM
  2. Help with creating a deck of cards
    By Carouselification in forum New To Java
    Replies: 5
    Last Post: 03-06-2011, 04:45 AM
  3. Deck of cards problem
    By VelvetMirror in forum New To Java
    Replies: 2
    Last Post: 02-16-2011, 08:02 PM
  4. Deck Shuffle
    By Cragsterboy in forum New To Java
    Replies: 1
    Last Post: 12-13-2010, 04:23 PM
  5. Deck of Cards
    By khunmato in forum New To Java
    Replies: 13
    Last Post: 09-06-2009, 05:47 PM

Posting Permissions

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