Question: Java Program Topics: abstract class, interface, package, serializable, factory design pattern The Problem Suppose you are a software engineer working for a small software consulting

Java Program

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. Download them and add them to your NetBeans project. Below are the interfaces provided for you:

Type of questions interfaces

o IMultipleChoiceQuestion

o ITrueFalseQuestion

o IFillInBlanksQuestion

o IShortAnswerQuestion

o IQuestion

Question set and question factory interfaces

o IQuestionSet (a collection of questions)

o IQuestionFactory (a factory to creating questions)

Java Program Topics: abstract class, interface, package, serializable, factory design pattern The

The IQuestionSet represents a collection of questions which serves as a test. For example, a user may create a set of questions named Midterm that has 20 questions in Java. The number of questions supported depends on the implementation.. For this exercise, you should use ArrayList as it will simplify the coding. The UML diagram above shows the operations IQuestionSet supports. You will use Serializable interface to support saving your question set.

To encourage you from using the implementation classes directory, you will implement the IQuestionFactory. The factory knows how to create the questions. Your program does not care what the name of the classes of the questions are. It only cares about the method provides by the interfaces. This is the concept of abstraction.

The interfaces should guide you in your implementation of the interfaces. The interfaces contain comments that describe what it is and what each method does. You will find the interfaces in the package com.jsoftware.test.api. You will add your implementation of the interfaces in the package com.jsoftware.test.impl.

The Programs

You will write two console programs that uses the interfaces and your implementation. The first program is named TestMaker which allows users to create test. The second program is named TestTaker lets a user loads an existing test and take it. The sample runs show how each program behaves. These programs should be in the package com.jsoftware.test.

To prevent your programs from being dependent on the question implementation, the only class it should know about is the question factory implementation. That makes your program very independent from the implementation. Changes to the names of implementation classes will not affect your program as it doesnt even care about their constructors. This makes your program much more maintainable.

The solution should implement multiple-choice question, true false question, fill in the blank question, short answer question question factory, and question set. Your program must compile and execute.

Provided code below:

IMultipleChoiceQuestion code:

Problem Suppose you are a software engineer working for a small software

ITrueFalseQuestion code:

consulting company called J Software. A high school has contracted your company

IFillInBlanksQuestion code:

to computerize their tests. Your company would provide software for the client

IShortAnswerQuestion code:

to create tests that students can take on computers. Your project lead

IQuestion code:

has analyzed the requirements and came up with some Java interfaces for

IQuestionSet code:

type of questions the program must support and has assigned to you

to implement the solution. The implementation of the interfaces will also be

IQuestionFactory Code:

used to created the two programs that will be used by theschool. The first program is for creating questions for tests and the

My run on net beans:

Sample run for Test Maker program:

second program is for administering the tests to students. The Interfaces Theinterface code is posted on blackboard. Download them and add them toyour NetBeans project. Below are the interfaces provided for you: Type of

Sample run for Test Taker:

questions interfaces o IMultipleChoiceQuestion o ITrueFalseQuestion o IFillInBlanksQuestion o IShortAnswerQuestion o IQuestionQuestion set and question factory interfaces o IQuestionSet (a collection of questions)

Test taker sample run:

o IQuestionFactory (a factory to creating questions) The IQuestionSet represents a collection

> A QuestionFactory O+IQuestion makeMultipleChoice(String question, Stringl choices, int answer) O+IQuestion makeTrueFalse(String question, boolean answer) O+IQuestion makeFill inBlank(String question, String answers) O+IQuestion makeShortAnswer(String question, StringD keywords) O+IQuestionSet load(String filename) O+boolean save(lQuestionSet testSet, String filename) +1 QuestionSet makeEmptyTestSet0 > o Question ..1-> 0+String getQuestiono > o IQuestionSet O +lQuestionSet emptyTestSet0 +IQuestionSet randomSample(int size) o+boolean add(IQuestion question) > > FilllnBlanksQuestion o+boolean checkAnswer(StringD keywords) o IMultipleChoiceQuestion +boolean remove(int index) O+IQuestion getQuestion(int index) O+int size0 -boolean checkAnswer(int index) > > o IShortAnswerQuestion oITrueFalseQuestion O+boolean checkAnswer(String answer) O+boolean checkAnswer(boolean answer) > A QuestionFactory O+IQuestion makeMultipleChoice(String question, Stringl choices, int answer) O+IQuestion makeTrueFalse(String question, boolean answer) O+IQuestion makeFill inBlank(String question, String answers) O+IQuestion makeShortAnswer(String question, StringD keywords) O+IQuestionSet load(String filename) O+boolean save(lQuestionSet testSet, String filename) +1 QuestionSet makeEmptyTestSet0 > o Question ..1-> 0+String getQuestiono > o IQuestionSet O +lQuestionSet emptyTestSet0 +IQuestionSet randomSample(int size) o+boolean add(IQuestion question) > > FilllnBlanksQuestion o+boolean checkAnswer(StringD keywords) o IMultipleChoiceQuestion +boolean remove(int index) O+IQuestion getQuestion(int index) O+int size0 -boolean checkAnswer(int index) > > o IShortAnswerQuestion oITrueFalseQuestion O+boolean checkAnswer(String answer) O+boolean checkAnswer(boolean answer)

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!