Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Please help with unwrap, deck, shuffle cards

  1. #1
    Junior Member
    Join Date
    Feb 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Please help with unwrap, deck, shuffle 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.



    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
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 139 Times in 134 Posts

    Default Re: Please help with unwrap, deck, shuffle cards

    This same homework dump has been asked on multiple sites and in all sites the original poster refuses to show evidence of his work or ask a specific question. Locking.

Similar Threads

  1. Need help with Deck of Cards
    By yanksin1st in forum Java Theory & Questions
    Replies: 1
    Last Post: March 1st, 2012, 12:28 PM
  2. A deck of cards
    By glebovg in forum What's Wrong With My Code?
    Replies: 2
    Last Post: March 1st, 2012, 08:46 AM
  3. Adding cards back into deck
    By sp4ce in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 15th, 2011, 12:21 AM
  4. Sorting a deck of cards by suite or rank.
    By coyne20 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: December 13th, 2010, 07:47 AM
  5. [SOLVED] I am trying to shuffle up an array
    By rsala004 in forum Collections and Generics
    Replies: 3
    Last Post: July 18th, 2009, 03:31 PM