⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 multchoicequestionbean.java

📁 adf-faces 甲骨文的jsf组件,功能很强.开源免费.
💻 JAVA
字号:
package oracle.adfdemo.view.faces.survey;

import java.util.List;

/***
 *  class MultChoiceQuestionBean
 *
 * This bean represents a single multiple choice questions.  It has fields for
 * the question prompt, a list of choices, and the correct answer.
 *
 ***/


public class MultChoiceQuestionBean implements java.io.Serializable
{
  
  /** Constructors **/
  
  /**
   *  Class constructor (no arguments).
   */
  public MultChoiceQuestionBean()
  {
  }
  
  /**
   *  Class constructor.
   */
  public MultChoiceQuestionBean(String prompt,
                                List choices,
                                int correctIndex)
  {
    _prompt = prompt;
    _choices = choices;
    _correctIndex = correctIndex;
  }


  /*** Accessors ***/
  /**
   *  returns the question prompt.
   *
   *  @return the question prompt
   */
  public String getPrompt()
  {
    return _prompt;
  }


  /**
    *  returns the list of answer strings.
    */
  public List getAnswerStrings()
  {
    return _choices;
  }


  /**
   * typical toString method
   *
   * @return a String representation of a MultChoiceQuestionBean
   */
  public String toString()
  {
    String str = "[" + _prompt + "; " + _choices.toString() + "]";
    return str;
  }



  /**
   * returns a message describing the correct answer choices.
   *
   * @return a message describing the correct answer choices
   */
  public String getCorrectAnswerMessage()
  {
    return "The correct answer is: " + (String)_choices.get(_correctIndex);
  }

  /**
   * returns the index of the correct answer
   *
   * @return the index of the correct answer
   */
  public int getCorrectIndex()
  {
    return _correctIndex;
  }

  /* The question as a String object */
  private String   _prompt;
  
  /* arbitrary number of possible answer choices (Strings) */
  private List  _choices;

  /* The index of the correct answer */
  private int     _correctIndex;


} //end QuestionBean

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -