Package cs171a2
Class Card
java.lang.Object
cs171a2.Card
A class that represents a playing card with a rank and suit.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
identifier
public final int identifierThe identifier of the card. It is a unique number assigned to each card based on its rank and suit. The identifier is calculated as suit * 100 + rank.
-
-
Constructor Details
-
Card
public Card(int suit, int rank) Creates a new Card with the given suit and rank. It assigns the identifier as well- Parameters:
suit
- The suit of the card.rank
- The rank of the card.
-
-
Method Details
-
getRank
public int getRank()Gets the rank of the card.- Returns:
- The rank of the card.
-
setRank
public void setRank(int rank) Sets the rank of the card.- Parameters:
rank
- The new rank of the card.
-
getSuit
public int getSuit()Gets the suit of the card.- Returns:
- The suit of the card.
-
setSuit
public void setSuit(int suit) Sets the suit of the card.- Parameters:
suit
- The new suit of the card.
-