Question: JAVA: Egyptian Rat Slap Complete the following classes to model the ERS game. Card Card(int number, Suit suit) Suit suit int number String getName() String

JAVA:

Egyptian Rat Slap

Complete the following classes to model the ERS game.

Card

  • Card(int number, Suit suit)
  • Suit suit
  • int number
  • String getName()
  • String toString()

Stack

  • ArrayList cards
  • void addCard(Card c)
  • ArrayList peekAtTopCards(int number)
  • void clear()
    • remove all cards from this stack.
  • int size()
  • String toString()
    • Return toString of all the cards starting from the top (going down).
    • comma separated

ERSGame

  • Stack pot
    • the stack of cards in the middle.
  • boolean isASandwich()
    • the same number sandwiching any other number
    • Ex: 3, 5, 3
  • boolean isADouble()
    • 2 of the same number in a row.
  • boolean isAFlush()
    • 3 of the same suit in a row.
  • boolean isAStraight()
    • A sequence of 3 cards with sequential values.
    • Ex: 3, 4, 5 or 10, J, Q or 5, 4, 3 or Q, J, 10
  • boolean isASum()
    • 2 cards that sum to 10.
    • Ex: 3, 7 or 6, 4 or 2, 8
  • boolean isATopBottom()
    • The top card and the bottom card are the same value.

Classes:: Main.java, Card.java, Stack.java, ERSGame.java

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!