Question: ************************************************************************************** Interfaces for project ************************************************************************************** package com.jsoftware.test.api; public interface IFillInBlanksQuestion extends IQuestion{ /** * A fill in the blank question may contain multiple blanks. *

 ************************************************************************************** Interfaces for project ************************************************************************************** package com.jsoftware.test.api; public interface IFillInBlanksQuestion extends

IQuestion{ /** * A fill in the blank question may contain multiple

blanks. * Each blank must match each answer. * @param keywords An

array of answer the user provides. * @return */ public boolean checkAnswer(String[]

keywords); } package com.jsoftware.test.api; /** * Interface for multiple choice question. A

multiple choice question has * a question and a list of choices.

To check if a user has select the * correct choice, the

**************************************************************************************

Interfaces for project

**************************************************************************************

package com.jsoftware.test.api;

public interface IFillInBlanksQuestion extends IQuestion{ /** * A fill in the blank question may contain multiple blanks. * Each blank must match each answer. * @param keywords An array of answer the user provides. * @return */ public boolean checkAnswer(String[] keywords); }

package com.jsoftware.test.api;

/** * Interface for multiple choice question. A multiple choice question has * a question and a list of choices. To check if a user has select the * correct choice, the choice is convert to an index and is matched to the * correct index in the question. * * */ public interface IMultipleChoiceQuestion extends IQuestion{

/** * Check answer. * @param index The index of the choice. * @return True if answer is correct. */ boolean checkAnswer(int index); }

package com.jsoftware.test.api;

/** * * */ public interface IQuestion { /** * Return a formatted question as a string. It should include options if * the question is a multiple choice or true/false question. * * Multiple choice example * Which of the following is not a primitive type in Java? * 1) double * 2) int * 3) String * 4) boolean * * True false example: * int is not a primitive data type in Java. True/False? */ public String getQuestion();

}

package com.jsoftware.test.api;

import java.io.IOException;

/** * * */ public interface IQuestionFactory { /** * creates a multiple choice question. * @param question The question * @param choices The choices as an array * @param answer The index to the answer in the choices array * @return An instance of a multiple choice question. */ public IQuestion makeMultipleChoice(String question, String[] choices, int answer);

/** * creates a true-false question. * @param question The question. * @param answer The answer * @return an instance of a true-false question */ public IQuestion makeTrueFalse(String question, boolean answer);

/** * Creates a fill-in-the-blank question. * @param question The question, including the blanks * @param answers Array of answers to the blanks * @return an instance of a fill-in-the-blank question */ public IQuestion makeFillInBlank(String question, String [] answers);

/** * Create a short-answer question. * @param question The question. * @param keywords The answers as a list of key words. * @return an instance of a short answer question. */ public IQuestion makeShortAnswer(String question, String[] keywords);

/** * load a question set using the given filename. * @param filename The file containing the test set. * @return A Test set * @throws IOException if can't load the file. */ public IQuestionSet load(String filename);

/** * Save the test set using the given filename. * @param testSet The test set to be stored. * @param filename The filename to be used. * @return true if save is successful */ public boolean save(IQuestionSet testSet, String filename);

/** * Create an empty test set. * * @return an empty test set. */ public IQuestionSet makeEmptyQuestionSet();

}

package com.jsoftware.test.api;

/** * This interface represents a set of question. * * */ public interface IQuestionSet {

/** * Create an empty test set. * @return return an instance of a test set. */ public IQuestionSet emptyTestSet();

/** * return a test set consisting of a random questions. * @param size The number of random questions. * @return The test set instance containing the random questions. */ public IQuestionSet randomSample(int size);

/** * add a question to the test set. * @param question The question * @return True if successful. */ public boolean add(IQuestion question);

/** * * @param index Remove question using index * @return true if index is valid */ public boolean remove(int index);

/** * Retrieving a question using an index * @param index * @return the question if index is valid, null otherwise. */ public IQuestion getQuestion(int index);

/** * Return the number of questions in this test set. * @return number of questions. */ public int size();

}

package com.jsoftware.test.api;

/** * * */ public interface IShortAnswerQuestion extends IQuestion{ /** * Check answer for short answer question. * @param answer The user's answer as as a boolean * @return true if correct. */ public boolean checkAnswer(String answer); }

/* The interface for true false question. */ package com.jsoftware.test.api;

/** * * */ public interface ITrueFalseQuestion extends IQuestion{ /** * Check if the answer is correct. * @param answer The user's answer as as a boolean * @return true if correct. */ public boolean checkAnswer(boolean answer); }

Topics: abstract class, interface, package, serializable, factory design pattern The Problem Suppose you are a software engineer working for a small software consulting company called J Software. A high school has contracted your company to computerize their tests. Your company would provide software for the client to create tests that students can take on computers. Your project lead has analyzed the requirements and came up with some Java interfaces for type of questions the program must support and has assigned to you to implement the solution. The implementation of the interfaces will also be used to created the two programs that will be used by the school. The first program is for creating questions for tests and the second program is for administering the tests to students. The Interfaces The interface code is posted on blackboard. Below are the interfaces provided for you: Download them and add them to your NetBeans project. Type of questions interfaces ' o IMultipleChoiceQuestion o ITrueFalseQuestion o IFillInBlanksQuestion (optional extra credit) o IShortAnswerQuestion (optional extra credit) o IQuestion Question set and question factory interfaces o IQuestionset (a collection of questions) o IQuestionFactory (a factory to creating questions

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!