Advertisement
Guest User

Untitled

a guest
Feb 16th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. package question2;
  2.  
  3. public class FillInTheBlank {
  4.  
  5. private String question;
  6. private String answer;
  7.  
  8. /**
  9. * Argumented Constructor
  10. * @param q is the question
  11. * @param a is the answer to the question
  12. */
  13. FillInTheBlank(String q, String a){
  14. setQuestion(q);
  15. setAnswer(a);
  16. }
  17. /**
  18. * Copy Constructor
  19. * @param in is the object you want copied
  20. */
  21. FillInTheBlank(FillInTheBlank in){
  22. question = in.question;
  23. answer = in.answer;
  24. }
  25. /**
  26. * Sets the value of the question
  27. * @param q is the question
  28. */
  29. public void setQuestion(String q){
  30. question = q;
  31. }
  32. /**
  33. * Sets the value of the answer
  34. * @param a
  35. */
  36. public void setAnswer(String a){
  37. answer = a;
  38. }
  39. /**
  40. * Accesses the question
  41. * @return the question
  42. */
  43. public String getQuestion(){ return question; }
  44. /**
  45. * Accesses the answer to the question
  46. * @return the answer
  47. */
  48. public String getAnswer(){ return answer; }
  49. /**
  50. * Outputs the question and the answer
  51. */
  52. public String toString(){
  53. return "FillInTheBlank[Question:\"" + question + "\", Answer:\"" + answer + "]";
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement