Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

java code Description In this project youd will be developing a class library for some Question classes that can be used to create different types

java code
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Description In this project youd will be developing a class library for some Question classes that can be used to create different types of questions for a quiz or test. For example, a teacher could use this library of classes to store the questions they like to give on exams or to build quizzes that they want to give their students. This set of classes will include Question, TFQuestion (True-False Question), and SAQuestion (Short-Answer Question). Later in the course you'll also add the MCQuestion (Mutliple-Choice) question class. The diagram below shows how these classes are related: The Question class is an abstract class: it contains the common features of the other two question classes. You wouldn't instantiate this class but you could use it as a type (e.g. to contain an array of question objects). The TFQuestion class models a True-False type of question, which always has a boolean answer of true or false: this is the question's correct answer. For example, you might want to add the question "Java is an Object Oriented language." to your test bank so you'd have a question text of "Java is an Object Oriented language." and the answer would be stored as true (because that is a true statement). The SAQuestion class models a short-answer type of question, that is simply a question that has a short, String answer. For example, "What is the name of the person who invented the Java programming language?" The question text would be "What is the name of the person who invented the Java programming language?" and the String answer would be "James Gosling" becuase that's the actual correct answer to this question. Class Details Question - Has a questionld data member (int) that must be greater than 0. - Has a String questionText data member that is set to "TBD" (To Be Determined) when an empty Question object is created, but should not ever be an empty String when set by the programmer. - Has accessor and mutator methods for both data members. The mutator methods should throw an IllegalArgumentException with a clear and userfriendly message if the parameter is invalid. - Has a default constructor that sets the ID to 1 and the question text to "TBD". - Has a 2-param constructor that sets the question ID and the question text to programmer-specified values.. - Has an abstract isCorrect(Object guess) method that returns a boolean value. This method will be overridden in each of the child classes. - Has a tostring() method that returns the question id and the question text in the form: \#XXX: This is the question text for this question. (where XXX is the question ID and "This is the question text for this question." is the actual question text value). If the question text hasn't been entered yet (its value will be "TBD" then the question text should be displayed as "No question text entered." TFQuestion - Has a data member called answer (boolean) for the true or false answer to the question. - Has accessor and mutator methods for the answer data member (no validation is required). The default value is false. - Has a default constructor that sets the default values tor id, text, and All three classes must include complete and correct iAVADOC comments, You do answer. - Has a 3-param constructor that sets the values for the not have to actually generate your iAVADOCs, you only need to write the comment code. You must use the techniques shown in class and use proper programmerspecified id, question text, and answer. spelling and grammar. Testing your Library - Overrides the iscorrect(Object guess) method to return true if the guess and the answer are the same, and false otherwise. The programmer using this method could pass in a foolean or a String. so it should work with either one. If the programmer passes in something that's not a Boolean of String. iscorrect() should return false, Case doesn't matter. - Overrides the toString0 method to return a String representaticp of the If: question in the form \#OOOC: This is the question text for this question. [true or false?] Submission SAQuestion Follow these instructions carefullyyl - Has a String data member for the answer to the question. When an empty Your submission must follow all the submission cequirements outined in the SAQuestion object is ereated, this data member defaults to " 780. This data member may not be a null-string. - Has an accesser and mutator method for the answer data member. The Submissien Standards. mutator should throw an lilegatArgumentfxception with a clear and userfriendly message if the answer value is invalid. - Has a default constructor that sets the default values for question id, question text, and answer. - Has a 3 - param constructor that sets the id, question text, and answer to It is expected that all code will conform to the industry standards outined in lava programmer-specified values. - Ovemides the iscorrect(Object guess) method to return true if the object's Standards for this Course. string value is the same as the answer data member's value, and lalse You are to wumit 3 files: otherwise. You don't have to worry about the type of object being passed in if you code this correctly (hinti compare the guess's string value to the answer value - it will be a match or not, regardless of what kind of oblect guess ends up beingh. This is a case insensitive match. 1. A IAR file that you must build containing your library. 2. A sINGLf teat or word processed document containing all of your source code for all three classes in your question library facceptable file formats: tet, doc). - Overrides the tostring() method to return a String representation of this: question in the form mooc This is the question text for this

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

Databases DeMYSTiFieD

Authors: Andy Oppel

2nd Edition

0071747990, 978-0071747998

More Books

Students also viewed these Databases questions

Question

Define disability.

Answered: 1 week ago