Create 2 classes that implement Question: (1) MultipleChoiceQuestion, (2)FillInTheBlankQuestion. Create 2 classes that i

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Create 2 classes that implement Question: (1) MultipleChoiceQuestion, (2)FillInTheBlankQuestion. Create 2 classes that i

Post by answerhappygod »

Create 2 classes that
implement Question:
(1) MultipleChoiceQuestion, (2)FillInTheBlankQuestion.
Create 2 classes that
implement Answer, each one corresponds to one
Question type above:
(1) MultipleChoiceAnswer, (2) SingleWordAnswer.
How would I implement Question and Answer to create the classes
needed?
Given:
Create 2 Classes That Implement Question 1 Multiplechoicequestion 2 Fillintheblankquestion Create 2 Classes That I 1
Create 2 Classes That Implement Question 1 Multiplechoicequestion 2 Fillintheblankquestion Create 2 Classes That I 1 (133.49 KiB) Viewed 65 times
Create 2 Classes That Implement Question 1 Multiplechoicequestion 2 Fillintheblankquestion Create 2 Classes That I 2
Create 2 Classes That Implement Question 1 Multiplechoicequestion 2 Fillintheblankquestion Create 2 Classes That I 2 (44.64 KiB) Viewed 65 times
public interface Question * Returns the text of the question for display to the user */ public String getTextPrompt(); /** * Returns an array of all the possible answers a user may resond * to this question with. If this question does not provide a list * of possible answers, this method throws an exception */ public Answer [] getPossibleAnswers() throws NoAnswersException; * Returns the true answer to this question. If this question * does not have a single true answer, this method throws an * exception */ public Answer getCorrectAnswer() throws NoCorrectAnswerException; /** * Given a string entered by the user, this method returns * an appropriate answer object that represents the user's * response. If no such answer object can be created due to * the user's response being invalid, this method throws an * exception */ public Answer convertResponseToAnswer(String userResponse) throws InvalidResponseException; }

public interface Answer { /** * Returns a String that represents this Answer, * formatted for the user */ public String toString(); /** * Returns true if the other may be considered the same answer * as this one. */ public boolean isSameAs (Answer other); }
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply