Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package question2;
- public class FillInTheBlank {
- private String question;
- private String answer;
- /**
- * Argumented Constructor
- * @param q is the question
- * @param a is the answer to the question
- */
- FillInTheBlank(String q, String a){
- setQuestion(q);
- setAnswer(a);
- }
- /**
- * Copy Constructor
- * @param in is the object you want copied
- */
- FillInTheBlank(FillInTheBlank in){
- question = in.question;
- answer = in.answer;
- }
- /**
- * Sets the value of the question
- * @param q is the question
- */
- public void setQuestion(String q){
- question = q;
- }
- /**
- * Sets the value of the answer
- * @param a
- */
- public void setAnswer(String a){
- answer = a;
- }
- /**
- * Accesses the question
- * @return the question
- */
- public String getQuestion(){ return question; }
- /**
- * Accesses the answer to the question
- * @return the answer
- */
- public String getAnswer(){ return answer; }
- /**
- * Outputs the question and the answer
- */
- public String toString(){
- return "FillInTheBlank[Question:\"" + question + "\", Answer:\"" + answer + "]";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement