Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How I can override a question in this class The FillInQuestion subclass Create a class called FillInQuestion that extends Question. This kind of question is

How I can override a question in this class

The FillInQuestion subclass

Create a class called FillInQuestion that extends Question. This kind of question is created using a single string that contains the answer, surrounded by _- -_. A sample question like this would be The color _-white-_ is the most common color found on flags. The question should be displayed to the user as The color _____ is the most common color found on flags.

The first line of the constructor must be a call to Questions constructor using super. But you need to process the String before calling super. Do the following

Write two private static methods String parseQ(String) and String parseA(String) These take the constructors parameter and return the computed question/answer as specified above o So parseQ(The sky is _-blue-_) might return The sky is _________ o The __________ should be reasonably long.

Now your constructor might look like public FillInQuestion(String sentence, Diffenum diff) { super(parseQ(sentence), parseA(sentence), diff) on the first line.

If FillInQuestions parameter String does not contain _- and -_ and not in the correct order, throw an IllegalArgumentException. (You can throw this in the parseQ method)

Override Questions copy method. It still must return Question, but it will be creating a FillInQuestion object so that the actual type of the copy is correct.

Modify QuizManager to include at least two FillInQuestions in a quiz.

Write a JUnit test class that tests the constructor and copy methods of the FillInQuestion class are working properly. (The other methods are already tested by the JUnit test class for Question

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

(2) Determining the general form of the model.

Answered: 1 week ago

Question

How many kilograms are in 44 pounds? ,1kg=2.2lbs

Answered: 1 week ago

Question

The Nature of Nonverbal Communication

Answered: 1 week ago

Question

Functions of Nonverbal Communication

Answered: 1 week ago

Question

Nonverbal Communication Codes

Answered: 1 week ago