package cse1030; /** * Word puzzle where the puzzle word is the solution word * in reverse order. For example, if the solution word * is "forward" then the puzzle word is "drawrof". * * @author CSE1030Z * */ public class ReverseWordPuzzle extends AbstractWordPuzzle { private String reverse; /** * Create a reverse word puzzle given the solution word. * * @param word the solution word */ public ReverseWordPuzzle(String word) { super(word); StringBuilder b = new StringBuilder(word); this.reverse = b.reverse().toString(); } /** * Get the puzzle word. The puzzle word is the solution word in * reverse order. * * @see cse1030.AbstractWordPuzzle#getPuzzleWord() * * @return the puzzle word */ @Override public String getPuzzleWord() { return this.reverse; } }