Question: Java using eclipse can you please help me with this? develop a graphical desktop application for authoring quiz questions and deploying quizzes. The applications major

Java using eclipse

can you please help me with this?

develop a graphical desktop application for authoring quiz questions and deploying quizzes. The applications major features include: graphical user interface, question creation, quiz creation, quiz and question storage, quiz and question retrieval, and quiz deployment.

Quizzes

I need to create a software that should allows users to create, save, and load quizzes. Quizzes can contain one or more questions and any operation applied to quizzes should apply to all questions it contains. For example, saving a quiz should save the questions it contains, and loading a quiz should load all questions it contains.

Questions: When the user creates or loads an existing quiz, the graphical user interface should allow the manipulation of three question types: short answers, multiple choice, and multiple answers.

Short answer: Represents questions that can be answered by a short textual or numeric answer. To provide flexibility, a short answer type should keep track of one or more answers so that a users answer can be considered correct when it matches at least one of the expected answers. For example, the answer Java and Java programming language can both be accepted as correct answers.

Multiple choice : Represents questions that provide users with a list of possible answers to select from. There is only one correct answer from the list. Multiple answers. Similar to a multiple choice question, but it is possible to have 0 or more correct answers from a list. The graphical user interface should allow users to create, modify, rearrange, and delete questions that are associated with a quiz. Remember that saving and loading quizzes also saves and loads the questions associated with the quiz.

Saving and loading

Quizzes, and its associated questions, should be saved as a binary file (not a text file). Inversely, quizzes and its associated questions should be loaded from a binary file. The quiz creation and quiz deployment applications should both be able to load a quiz binary file.

Quiz deployment You need to create a separate application that will load a saved quiz (from a quiz binary file) and allow a user to take the quiz. Imagine that instructors use the quiz creation application to create and save quizzes while learners use the quiz deployment application to load and take quizzes. The quiz deployment application should provide a graphical interface that will sequentially display one question at a time. Remember that there are three types of questions that the application should support. The interface should inform users whether their answer was correct or wrong, and should show the correct answer immediately after they submit it. Users are not allowed to skip questions or review previous questions. The application should show the users total score when they complete the quiz. Assume that all questions are worth 1 point.

I already have these from my previous programs that it should changed in some parts:

public class Question{ private String question, answer; public Question(String question, String answer){ this.question = question; this.answer = answer; } public String askQuestion(){ return question; } public boolean check(String userAnswer){ return answer.equals(userAnswer); } protected String getAnswer(){ return answer; } public void setAnswer(String answer){ this.answer = answer; } public void setQuestion(String question){ this.question = question; } @Override public Question clone(){ return new Question(question, answer); } @Override public String toString(){ return askQuestion(); } } import java.util.ArrayList; import java.util.Iterator; public class MultipleChoiceQuestion extends Question{ private ArrayList possibleAnswers; public MultipleChoiceQuestion(String question, String answer, ArrayList possibleAnswers){ super(question, answer); this.possibleAnswers = possibleAnswers; } @Override public String askQuestion(){ String result = super.askQuestion() + " "; Iterator it = possibleAnswers.iterator(); int ctr = 0; while(it.hasNext()){ result += ((++ctr) + "." + it.next() + " "); } return result; } public void setPossibleAnswers(ArrayList possibleAnswers){ this.possibleAnswers = possibleAnswers; } public ArrayList getPossibleAnswers(){ return possibleAnswers; } @Override public MultipleChoiceQuestion clone(){ ArrayList tempPossibleAnswers = new ArrayList<>(); for(String val:possibleAnswers){ tempPossibleAnswers.add(val); } MultipleChoiceQuestion temp = new MultipleChoiceQuestion(super.askQuestion(), getAnswer(), tempPossibleAnswers); return temp; } @Override public String toString(){ return askQuestion(); } } import java.io.FileWriter; import java.io.BufferedWriter; import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; public class Quiz { private ArrayList questions; private String filename; public Quiz(String filename){ questions = new ArrayList<>(); this.filename = filename; } public void addQuestion(Question q){ questions.add(q); } @Override public String toString(){ String result = ""; Iterator it = questions.iterator(); while(it.hasNext()){ result += (it.next() + " "); } return result; } public void save(){ try(BufferedWriter writer = new BufferedWriter(new FileWriter(filename))){ Iterator it = questions.iterator(); int ctr = 0; while(it.hasNext()){ writer.write((++ctr) + ")"); writer.write(it.next().toString()); writer.write(" "); } }catch(IOException ioe){ ioe.printStackTrace(); } } } import java.util.ArrayList; public class Driver { public static void main(String[] args){ Quiz quiz1 = new Quiz("quiz.txt"); Question q = new Question("How many days are there in a week?", "7"); quiz1.addQuestion(q.clone()); ArrayList possibleAnswers = new ArrayList<>(); possibleAnswers.add("March"); possibleAnswers.add("Autumn"); possibleAnswers.add("Monday"); possibleAnswers.add("2017"); q = new MultipleChoiceQuestion("Which among the following is the name of a day in a week?", "3", possibleAnswers); quiz1.addQuestion(q.clone()); System.out.println(quiz1); quiz1.save(); } } 

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!