Package project2

Class Deck

java.lang.Object
project2.Deck

public class Deck extends Object

Title: The Deck class

Description: This class represents a Deck of 52 playing cards. It gets created in order and then must be shuffled to randomize the order of the cards. Cards are dealt from the top of the deck.

Author:
NCC CS1 Professors
  • Constructor Summary

    Constructors
    Constructor
    Description
    default constructor which creates the deck of 52 cards in order
  • Method Summary

    Modifier and Type
    Method
    Description
    dealCard -- deals the top card from the deck and decreases the number of cards in the deck by 1
    void
    Places the cards in the deck in a random order
    void
    shuffleDeck(int seed)
    Places the cards in the deck in a random order

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Deck

      public Deck()
      default constructor which creates the deck of 52 cards in order
  • Method Details

    • shuffleDeck

      public void shuffleDeck()
      Places the cards in the deck in a random order
    • shuffleDeck

      public void shuffleDeck(int seed)
      Places the cards in the deck in a random order
      Parameters:
      seed - Seed for the random number generator
    • dealCard

      public Card dealCard()
      dealCard -- deals the top card from the deck and decreases the number of cards in the deck by 1
      Returns:
      a reference to the Card being dealt