You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

 

Suit-enum
public enum Suit {
	
	HEARTS(CardColor.RED, "Hearts"), DIAMONDS(CardColor.RED, "Diamonds"),
	SPADES(CardColor.BLACK, "Spades"), CLUBS(CardColor.BLACK, "Clubs");
	
	private CardColor color;
	private String text;
	
	private Suit (CardColor c, String suitText) {
		this.color = c;
		this.text = suitText;
	}
	
	public CardColor getCardColor() {
		return this.color;
	}
	
	public String getSuitAsText() {
		return text;
	}
} 

 

 

CardColor-enum
public enum CardColor {
	RED, BLACK;
}

 

  • No labels