1 Star 1 Fork 0

CS-IMIS-23/20172313yukunpeng

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Question.java 2.75 KB
一键复制 编辑 原始数据 按行查看 历史
余坤澎 提交于 7年前 . docs:example practice
//********************************************************************
// Question.java Author:Lewis/Loftus
//
// Represents a question (and its answer).
//********************************************************************
public class Question implements Complexity
{
private String question, answer;
private int complexityLevel;
//--------------------------------------------------------------------
//Constructor:Sets up the question with a default complexity.
//--------------------------------------------------------------------
public Question(String query,String result)
{
question = query;
answer = result;
complexityLevel = 1;
}
//--------------------------------------------------------------------
//Sets the complexity level for this question. //--------------------------------------------------------------------
public void setComplexity(int level)
{
complexityLevel = level; }
//--------------------------------------------------------------------
//Returns the complexity level for this question.
//--------------------------------------------------------------------
public int getComplexity()
{
return complexityLevel; }
//-------------------------------------------------------------------- //Returns the question.
//--------------------------------------------------------------------
public String getQuestion()
{ return question; }
//--------------------------------------------------------------------
//Return the answer to this question.
//--------------------------------------------------------------------
public String getAnswer()
{
return answer;
}
//-------------------------------------------------------------------- //Returns true if the candidate answer matches the answer.
//--------------------------------------------------------------------
public boolean answerCorrect(String candidateAnswer)
{
return answer.equals(candidateAnswer);
}
//--------------------------------------------------------------------
// Returns this question (and its answer) as a string //--------------------------------------------------------------------
public String toString()
{
return question + "\n" + answer;
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/CS-IMIS-23/20172313yukunpeng.git
git@gitee.com:CS-IMIS-23/20172313yukunpeng.git
CS-IMIS-23
20172313yukunpeng
20172313yukunpeng
master

搜索帮助