Question: I am trying to implement Java code to create a question thats choices to choose from, but also have multiple correct answers. This is the

I am trying to implement Java code to create a question thats choices to choose from, but also have multiple correct answers.

This is the code;

I am trying to implement Java code to create a question thats

1 package questionsapp; 3 import java.util.ArrayList; 4 6 public class AnyCorrectChoice extends AnyChoiceQuestiont private ArrayList choices; private String answer; 9 10 /kok Constructs a choice question with no choices. 12 13 14 public AnyCorrectChoice() 15 16 17 18 choices new ArrayListO; public void addChoice(String choice, boolean correct) 20 21 choices.add(choice); if (correct) // Here is where I want to implement the multiple correct answers 23 24 25 26 27 28 29 30 31 32 //But can't seem to do so. // Convert choices.size() to string String choiceString choices.sizeO; setAnswer(choiceString); public void display() // Display the question text super.display ); // Display the answer choices for (int 1= 0; 1 choices; private String answer; 9 10 /kok Constructs a choice question with no choices. 12 13 14 public AnyCorrectChoice() 15 16 17 18 choices new ArrayListO; public void addChoice(String choice, boolean correct) 20 21 choices.add(choice); if (correct) // Here is where I want to implement the multiple correct answers 23 24 25 26 27 28 29 30 31 32 //But can't seem to do so. // Convert choices.size() to string String choiceString choices.sizeO; setAnswer(choiceString); public void display() // Display the question text super.display ); // Display the answer choices for (int 1= 0; 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!