Question: //Card Class public abstract class Card implements Comparable { /* handy arrays for ranks and suits */ /* do NOT change these */ public final


![final static String[] RANKS = { "None", "Joker", "2", "3", "4", "5",](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3918e52a6d_54166f3918da09fd.jpg)

//Card Class
public abstract class Card implements Comparable
/* handy arrays for ranks and suits */
/* do NOT change these */
public final static String[] RANKS = { "None", "Joker",
"2", "3", "4", "5", "6", "7", "8", "9", "10",
"Jack", "Queen", "King", "Ace"};
public final static String[] SUITS = { "Diamonds",
"Clubs", "Hearts", "Spades", "NONE"};
/** creates a card with specified suit and rank
*
* @param suit is the suit of the card (must be a string from Card.SUITS)
* @param rank is the rank of the card (must be a string from Card.RANKS)
*/
public Card(String suit, String rank){
// add code here if needed
}
/** the numerical representation of the rank of the current card
*
* ranks have the numerical values
* Joker = 1,
* 2 = 2, 3 = 3, ..., 10 = 10
* Jack = 11, Queen = 12, King = 13, Ace = 14
*
* @return the numerical rank of this card
*/
public abstract int getRank();
/** the string representation of the rank of the current card
*
* @return the string representation of the rank of this card (must be a string from Card.RANKS)
*/
public abstract String getRankString();
/** the suit of the current card
*
* @return the suit of this card (must be a string from Card.SUITS)
*/
public abstract String getSuit();
@Override
public final String toString(){
// outputs a string representation of a card object
int r = getRank();
if( r >= 2 && r
return r + getSuit().substring(0,1);
}
if (r == 1){
return "J";
}
return "invalid card";
}
}
//Deck class
import java.util.List;
/* finish all of the constructors and methods given here */
/* do NOT add any public attributes or methods */
/* add any protected/private attributes you need */
public class Deck{
public Deck(){}
public Deck(int nun_jokers){}
public List
public Card getCard(){return null;}
public void addCard(Card c){}
}
//Hand class
import java.util.List;
public class Hand{ protected List
//Player class
public abstract class Player{ protected Hand hand; public Player(Hand hand){ this.hand = hand; } /* play a card from the player's hand */ /* returns null if they cannot play a card and the deck becomes empty */ /* do NOT return null unless you cannot play a card and the deck is empty */ public abstract Card play(Card top_of_discard_pile, Deck deck); public final int cardsLeft(){ return this.hand.numberOfCards(); } }
A standard deck of playing cards consists of 52 cards. Each card has a rank (2, 3,..,9, 10, Jack, Queen, King, or Ace) and a suit (spades , hearts , clubs , or diamonds) You will create a class called StandardCard that will simulate cards from a standard deck of cards. Your class will extend the Card class (provided) The ordering of the cards in a standard deck (as defined for this assignment) is first specified by the suit and then by rank if the suits are the same. The suits and ranks are ordered as follows suits: The suits will be ordered diamonds ?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
