/**
* Copyright (C) 2022 by Martin Robillard. See https://codesample.info/about.html
*/
package e2.chapter9;
/**
* Represents the suit of a playing card.
*/
public enum Suit
{
CLUBS, DIAMONDS, SPADES, HEARTS;
public enum Color { RED, BLACK }
/**
* @return The color of the suit.
*/
public Color getColor()
{
if( this == CLUBS || this == SPADES )
{
return Color.BLACK;
}
else
{
return Color.RED;
}
}
}