package cse1030; /** * A word puzzle where the puzzle word is formed by taking * the letters of the solution word in reverse order. For * example the puzzle word "elzzup" has the solution * "puzzle". * * @author EECS1030_2014_15W * */ public class ReverseWordPuzzle extends AbstractWordPuzzle { private String solution; /** * Creates a reverse word puzzle. The solution word is * simply the puzzle word in reverse. * * @param puzzleWord the puzzle word */ public ReverseWordPuzzle(String puzzleWord) { super(puzzleWord); this.solution = (new StringBuilder(puzzleWord)).reverse().toString(); } /** * Get the solution for this reverse word puzzle. * * @return the solution for this reverse word puzzle * @see cse1030.AbstractWordPuzzle#getSolution() */ @Override public String getSolution() { return this.solution; } }