// Rank.java - John K. Estell - 8 May 2003 // last modified: 16 Febraury 2004 // Implementation of the "rank" value for a playing card. import java.util.*; /** * Specification of the rank values for a standard deck of cards. * Client has ability to set either the ace or the king to be the * highest ranking card; default is king high. Ranks are * established in the following ascending order: *

King high: ace, 2, 3, 4, 5, 6, 7, 8, 9, 10, jack, queen, king. *

Ace high: 2, 3, 4, 5, 6, 7, 8, 9, 10, jack, queen, king, ace. *

Class can be extended for implementation of speciality decks * containing a subset of the standard ranks, e.g. pinochle. */ public class Rank implements Comparable { // instance variables for rank // your code goes here /** * The rank ace. */ // your code goes here /** * The rank two. */ // your code goes here /** * The rank three. */ // your code goes here /** * The rank four. */ // your code goes here /** * The rank five. */ // your code goes here /** * The rank six. */ // your code goes here /** * The rank seven. */ // your code goes here /** * The rank eight. */ // your code goes here /** * The rank nine. */ // your code goes here /** * The rank ten. */ // your code goes here /** * The rank jack. */ // your code goes here /** * The rank queen. */ // your code goes here /** * The rank king. */ // your code goes here /** * List of all rank values. Used primarily for the purpose of iteration. */ // your code goes here // Constructor - declared private as only the predefined values should // be used by the client. private Rank( String nameValue, String symbolValue ) { // your code goes here } /** * Sets the king to be the card having highest rank. The ace is * reduced to the lowest rank. */ public static void setKingHigh() { // your code goes here } /** * Sets the ace to be the card having highest rank. The two becomes * the lowest rank. */ public static void setAceHigh() { // your code goes here } /** * Returns a description of this rank. * @return the name of this rank. */ public String getName() { // your code goes here } /** * Returns a description of this rank. * @return the name of this rank. */ public String toString() { // your code goes here } /** * The symbol associated with this rank. Returns the symbol, which * usually constitutes a single character, in the form of a string. * Symbol is used for the construction of the filenames of the card images. * @return string containing the symbol for the rank. */ public String getSymbol() { // your code goes here } /** * Compares the ranks. Result is dependent on the whether the ace * or the king is considered to be the high rank. * @param otherRankObject the other rank. * @return the arithmetic difference between the compared ranks * based on their ordering in the listing of values. This result * may differ depending on whether the king or the ace is considered * the high card. Result will be < 0 if this rank is lower than * the other rank, 0 if the ranks are the same, or > 0 if this * rank is higher than the other rank. */ public int compareTo( Object otherRankObject ) { // your code goes here } }