I wish to write a method that can return the difference in value of 2 cards.
Im confused as I’m learning enums and not sure of the most efficient way to implement it.
public class Card implements Comparable<Card> {
public enum Rank {TWO, THREE, FOUR, FIVE, SIX,SEVEN, EIGHT, NINE, TEN,
JACK, QUEEN, KING, ACE}
public enum Suit {CLUBS, DIAMONDS, HEARTS, SPADES}
public static int difference(Card c){
}
Any help or guidance would be appreciated.
which can then be called like so :
You could remove the int value and just use ordinal, but this way gives you a bit of flexibility.