Question: The objective of this assignment is to implement a basic API for Card games, and then code a simple Card game Card.iava Define a Card

 The objective of this assignment is to implement a basic APIfor Card games, and then code a simple Card game Card.iava Definea Card class with the following API: public Card(Suit suit, int rank)

The objective of this assignment is to implement a basic API for Card games, and then code a simple Card game Card.iava 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.iava 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 Hand. java Then define a Hand class, that is a set of cards held by a player. This class also keeps an ArrayList of cards and should support the following API: public Hand (int m) //specifies initial size of hand public Card drawNext) //draws "next" card from hand public Card draw(String s) //draws specific card from hand, in format "8s", "1c", "11h", "13d" public void addCard (Card c) //adds card to hand public ArrayList getCards) // gets the list of Cards in hand Define the following custom exception classes, and throw them at appropriate places in the preceding classes CardException extends RuntimeException DeckOrHandEmptyException extends CardException InvalidCardException extends CardException The objective of this assignment is to implement a basic API for Card games, and then code a simple Card game Card.iava 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.iava 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 Hand. java Then define a Hand class, that is a set of cards held by a player. This class also keeps an ArrayList of cards and should support the following API: public Hand (int m) //specifies initial size of hand public Card drawNext) //draws "next" card from hand public Card draw(String s) //draws specific card from hand, in format "8s", "1c", "11h", "13d" public void addCard (Card c) //adds card to hand public ArrayList getCards) // gets the list of Cards in hand Define the following custom exception classes, and throw them at appropriate places in the preceding classes CardException extends RuntimeException DeckOrHandEmptyException extends CardException InvalidCardException extends CardException

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!