public class Card { public static final int HIGHID = 52; //number of card int id; public static final char[] SUITS = {'D','C','H','S'}, RANKS = {'A','2','3','4','5','6','7','8','9','T','J','Q','K'}; public Card(String shortDesc) { id = charToRank(shortDesc.charAt(0))*4 + charToSuit(shortDesc.charAt(1)); if (id < 0 || id > HIGHID) throw new RuntimeException("Description could not be translated"); } //returns id or number of the card public Card(int id) { if (id < 0 || id > HIGHID) //if ID is out of bounds throw an exception throw new RuntimeException("Description could not be translated"); this.id = id; } //returns a boolean.....color Red - T, color black - F public boolean isRed() { return ((id%4) %2) == 0; } public int suit() { return id%4; } public int rank() { return id/4; } public boolean isAce() { return id/4 == 0; } //returns true if the card is of ID 12 or the card is a king public boolean isKing() { return id/4 == 12; } //this function is used for foundation...where the card to //be put on is of higher value and same color public boolean goesOn(Card c) { return ( (c.id % 4) == (id % 4) && (id/4) == ((c.id/4)-1) ); } //this function is used for tableau...where the card to be //put on is of lower value and the color alternated public boolean goesUnder(Card c) { return (c.isRed() != isRed()) && ((id/4) == ((c.id/4)-1)); } //returns the number associated with the card...A = 1, J=10, Q = 11, K=12 private int charToRank(char c) { for (int i=0; i