/** * Represents a Question to be posed playing the * 20 Questions Game * * @author Chris Thiel, OFMCap * @version 17 Jun 2025 * * based on 2011 version */ public class Question { private String question; private int parentLink, noLink, yesLink; public Question(String question, int parentLink, int noLink, int yesLink) { this.question = question; this.parentLink = parentLink; this.noLink = noLink; this.yesLink = yesLink; } public Question() { this("", -1, -1, -1); } public int getParentLink() { return parentLink; } public void setParentLink(int parentLink) { this.parentLink = parentLink; } public int getNoLink() { return noLink; } public void setNoLink(int noLink) { this.noLink = noLink; } public int getYesLink() { return yesLink; } public void setYesLink(int yesLink) { this.yesLink = yesLink; } public String getQuestion() { return question; } public void setQuestion(String question) { this.question = question; } public String toString(){ return parentLink+"\t"+noLink+"\t"+yesLink+"\t"+question; } public String lastWord(){ String lastThing=question.substring(question.lastIndexOf(" "),question.lastIndexOf("?")); //lastThing=lastThing.substring(0, lastThing.length()-1); return lastThing; } }