Difference between revisions of "Acey Deucey assignment"

From WLCS
(Card class)
Line 25: Line 25:
 
** int getValue()
 
** int getValue()
 
*** returns the numerical value of the card
 
*** returns the numerical value of the card
 +
** String toString()
 +
*** returns the String representation of the card in the form "NAME of SUIT"
  
 
=== Deck class ===
 
=== Deck class ===

Revision as of 10:04, 1 December 2015

Objective(s)

  • You will implement the card game Acey Deucey
  • You will design and implement Java classes
  • You will analyze the rules and design the flow of your game

Resource(s)

Direction(s)

Card class

  • Attributes
    • String suit
    • String name
  • Constructor
    • Card() - default constructor
    • Card(String suit, String value) - specific constructor
      • Sets the internal attributes to the same as the parameters
  • Methods
    • String getSuit()
    • void setSuit()
    • String getName()
    • void setName()
    • int getValue()
      • returns the numerical value of the card
    • String toString()
      • returns the String representation of the card in the form "NAME of SUIT"

Deck class

  • Attributes
    • Card[] deck
    • int top
  • Constructor
    • Deck()
      • The deck attribute should be initialized to 52 new Cards
      • You must then go through and set all the values of all the cards
  • Methods
    • void shuffle()
      • Use a loop that swaps random cards around
    • Card deal()
      • Returns the current top card of the deck AND advances the top to the next card
    • void reset()
      • Resets the top index to 0

Acey Deucey class

  1. This class will be where you put your main() method
  2. Write all the comments for the flow of the program (i.e. outline how your program will run in comments)
  3. Implement the game in the main class