In this Assignment you will use an abstract class to define, read, store, and print questions for a test. you will start by writing an abstract TestQuestion class that contains the following: • A...


In this Assignment you will use an abstract class to define, read, store, and print questions for a test.<br>you will start by writing an abstract TestQuestion class that contains the following:<br>• A protected String variable that holds the test question.<br>• An abstract method protected abstract void readQuestion() to read the question.<br>Now define two subclasses of TestQuestion, Essay and MultChoice which implement the abstract methods. Essay will need an instance variable to store the<br>number of blank lines needed for the answering space. MultChoice will not need this variable, but it will<br>need an array of Strings to hold the choices along with the main question.<br>You will also need to write toString methods for the MultChoice and Essay classes that return nicely formatted versions of the questions.<br>Now define a class WriteTest that creates an Arraylist of TestQuestion objects.<br>Assume that the input as the following:<br>1. type of question (character, m3Dmultiple choice, e=essay).<br>2. number of blank lines for essay, number of blank lines for multiple choice (integer).<br>3. the question text.<br>4. choice 1 (multiple choice only)<br>5. choice 2 (multiple choice only) .<br>Windows buiij<br>Ind<br>Save each object in the ArrayList object to hold the various TestQuestion objects (Essay or MultChoice objects). Use a loop to print the questions from the<br>ArrayList as completed quiz.<br>

Extracted text: In this Assignment you will use an abstract class to define, read, store, and print questions for a test. you will start by writing an abstract TestQuestion class that contains the following: • A protected String variable that holds the test question. • An abstract method protected abstract void readQuestion() to read the question. Now define two subclasses of TestQuestion, Essay and MultChoice which implement the abstract methods. Essay will need an instance variable to store the number of blank lines needed for the answering space. MultChoice will not need this variable, but it will need an array of Strings to hold the choices along with the main question. You will also need to write toString methods for the MultChoice and Essay classes that return nicely formatted versions of the questions. Now define a class WriteTest that creates an Arraylist of TestQuestion objects. Assume that the input as the following: 1. type of question (character, m3Dmultiple choice, e=essay). 2. number of blank lines for essay, number of blank lines for multiple choice (integer). 3. the question text. 4. choice 1 (multiple choice only) 5. choice 2 (multiple choice only) . Windows buiij Ind Save each object in the ArrayList object to hold the various TestQuestion objects (Essay or MultChoice objects). Use a loop to print the questions from the ArrayList as completed quiz.

Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here