Help Needed


It is time to show off all of your incredible talent and all that you have learned by programming a simple card game, we will use the concept of poker, but without actual cards.  You will have three separate, or internal classes that will:

  1. Instantiate a Card
  2. Instantiate a Deck of those Cards, and shuffle and deal them.
  3. Play the game.

In this project you will simulate the playing of a simple card game. You are given a Card and Deck class to use. The Card class should not be changed or renamed, I will use my own Card class when testing your files.

This assignment should be submitted in two classes; Main +last Name, Deck +last Name, or using internal declared classes, but will not be referenced in this manner henceforth. The first class, Deck, will be a modification of the class I have provided. You will need to implement the shuffle Deck method in order for this class to be usable, which has already been written for you in a method.

The second class, Main, will use the Card class and your modified Deck class to create a shuffled Deck object and deal the two hands. The hands should be dealt in alternating order, starting with the first hand. As the cards are dealt into each hand they should be removed from the deck.

For example, each hand is shown for the following Deck.

seven of spades    <-- Index 0, top card
queen of spades   <-- Index 1, etc.
ten of spades
eight of spades
three of spades
king of hearts
queen of hearts
jack of clubs
four of clubs
eight of clubs
king of diamonds
seven of hearts

Hand 1:  Hand 2:seven of spades queen of spades ten of spades  eight of spades three of spades king of hearts queen of hearts jack of clubs four of clubs eight of clubs

Each of these cards should be removed from the deck.

After dealing the hand, Main should use the point value attribute of each card to calculate the total point value of each hand. The hand with the highest point value wins. In the case of a draw, the second hand wins. In this game ace = 1, jack = 11, queen = 12, and king = 13. In the deck the card in the first position (index 0) is the top of the deck.

Lastly, Main will declare the winning hand. See the following sample run for the exact format that will be expected.

Sample Run of Main:

Hand 1: Total points 22
three of clubs (point value = 3)
two of clubs (point value = 2)
six of hearts (point value = 6)
ten of hearts (point value = 10)
ace of spades (point value = 1)

Hand 2: Total points 27
four of spades (point value = 4)
ten of clubs (point value = 10)
three of diamonds (point value = 3)
eight of diamonds (point value = 8)
two of hearts (point value = 2)

Hand 2 wins

Play again (y/n)?

To plan for the program, you should review the given classes. Knowing which methods are available to you will be very helpful in designing your game. Then, you should plan the algorithms that you will design.

Use the following table to plan your program.

Card/Deck Methods & Variables Main

Card – Methods & Variables

  • String suit, String rank, int point Value
  • public Card(String card Rank, String card Suit, int card Point Value)
  • public String suit()
  • public String rank()
  • public int get Point Value()
  • public Boolean matches(Card other Card)
  • public String to String(); use to print each card with a for each

Deck – Methods & Variables

  • private Array List<Card> deck;
  • constructor method; instantiate deck Array List object, populate elements with cards by calling initialization method, and shuffle it by calling shuffle Deck() (written for you).
  • method to initialize the deck with 52 cards and set their point values; Ace of Clubs through King of Spades.
  • method to return the top card from the deck and remove it from the stack; return type should match what you are returning.

Main. main

  • instantiate a new Deck object based on Card element types
  • establish two arrays, one for each hand to be dealt
  • deal 5 cards to each hand calling the get Top Card() method from Deck{}
  • total up the values for each hand using get Point Value() from Card{}
  • display the cards and their point values for each hand
  • determine the winning hand and display

You do NOT need to hand in Card, nor customize the class or the instantiation usage of Card in Deck or Main! But you still need to change Deck and Main to include your last name.

PLAGIARISM will earn a ZERO!  Copying someone else’s code online, or another student is also considered plagiarism.