Answered step by step
Verified Expert Solution
Question
1 Approved Answer
public class Question { 2. // fields 3. private String question; 4. private String answer1; 5. private String answer2; 6. private String answer3; 7. private
public class Question { 2. // fields 3. private String question; 4. private String answer1; 5. private String answer2; 6. private String answer3; 7. private String answer4; 8. private int correctAnswer; 9. 10. // constructor 11. public Question(String question, String answer1, String answer2, 12. String answer3, String answer4, int correctAnswer) { 13. this.question = question; 14. this.answer1 = answer1; 15. this.answer2 = answer2; 16. this.answer3 = answer3; 17. this.answer4 = answer4; 18. this.correctAnswer = correctAnswer; 19. } 20. 21. // accessor methods 22. public String getQuestion() { 23. return question; 24. } 25. 26. public String getAnswer1() { 27. return answer1; 28. } 29. 30. public String getAnswer2() { 31. return answer2; 32. } 33. 34. public String getAnswer3() { 35. return answer3; 36. } 37. 38. public String getAnswer4() { 39. return answer4; 40. } 41. 42. public int getCorrectAnswer() { 43. return correctAnswer; 44. } 45. 46. // mutator methods 47. public void setQuestion(String question) { 48. this.question = question; 49. } 50. 51. public void setAnswer1(String answer1) { 52. this.answer1 = answer1; 53. } 54. 55. public void setAnswer2(String answer2) { 56. this.answer2 = answer2; 57. } 58. 59. public void setAnswer3(String answer3) { 60. this.answer3 =
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started