Question: Java Program -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- /** A terrain class for a game board with hexagonal tiles. * The game determines the meaning of the various terrains. *
Java Program
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/** A terrain class for a game board with hexagonal tiles.
* The game determines the meaning of the various terrains.
* We use light colors for rendering (except inaccessible) to help with contrast.
*/
public enum Terrain {
INACCESSIBLE(Color.BLACK),
WATER(Color.CYAN),
LAND(Color.WHITE),
FOREST(Color.GREEN),
MOUNTAIN(Color.LIGHT_GRAY),
CITY(Color.ORANGE),
DESERT(Color.YELLOW);
private final Color color;
//There is no public constructor. Why not?
private Terrain(Color c) {
// TODO: initialize the color field
}
/**
* Return the suggested color to use for this terrain.
* Color is light to permit dark foregrounds to be used on figures on tiles.
* @return color associated with this terrain.
*/
public Color getColor() {
// TODO: return the color for this terrain
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
