Question
Card.java Define a Card class with the following API: public Card(Suit suit, int rank) public int getRank() public Suit getSuit() public String toString() // Ace
Card.java
Define a Card class with the following API:
public Card(Suit suit, int rank)
public int getRank()
public Suit getSuit()
public String toString() // "Ace of Spades"
Note that Suit is an enumerated type. Your Card class should also implement the Comparable interface.Order cards with the different Suits ranked, from lowest to highest, as CLUBS, DIAMONDS, HEARTS, SPADES, and then in ascending order of their rank within the Suit
Deck.java
Implement a Deck class that keeps an ArrayList of cards. Provide the following API:
public Deck()
public String toString() // print all cards in deck
public boolean isDeckEmpty()
public Card deal() //deals the topmost card in deck
public void shuffle() //shuffles cards in deck
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started