Build a QuizApp that allows the user to practice a subject by taking a quiz containing a series of basic fill-in-the blank
questions as many times as they like. Each time the quiz is taken, the questions should be randomly shuffled to
avoid the memorization of answers in a particular order. Once the user has read and answered a question,
they receive a point if a response is correct otherwise they are given the proper answer.
Quiz applications are data driven. They rely on questions and answers to questions as primary game elements.
Normally quiz data, such as the questions and answers, should be stored as external text files. In this application
you will be asked to populate our quiz directly from your code file.
Goal 1: Build your app using the following Dependency and Aggregation Structure.
Goal 2: Use the following UML diagram (Unified Modeling Language) as your guide in building each class.
Part II: Inheritance
Inheritance is a relationship between a more general class ( called the superclass) and a more specialized class (called the subclass).
All Java classes are derived, directly or indirectly, from the Object class.
The toString() and equals() methods are inherited by every class in every Java program.
The subclass inherits data and behavior from the superclass.
Java uses the reserved word extends to indicate that a new class is being derived from an existing class.
The process of inheritance establishes an is-a relationship.
The subclass (child class) inherits all public methods from the superclass (parent class).
A parent's constructor can be invoked using the super reference.
Private members are inherited by the child class, but cnnot be referenced directly by name. They may be used indirectly, however.
When member data or method is declared with the protected modifier, a derived class can reference it.
A child class can override (redefine) the parent's definition of an inherited method. When you supply a new implementation for an inherited method, you override the method.
You declare any methods that are new to the subclass, and change the iomplementation of inherited methods if the inherited behavior is not appropriate.
Exercise 1: The QuizApp
A quiz application often consists of various types of questions: fill-in-the-blank, multiple choice, and true and false.
Each question type inherits attributes from a superclass of Question.
Using the Question class, construct a subclass for MultipleChoice. Use the following guidelines:
A MultipleChoice object store the various choices for the answer.
A method will be used for adding answer choices.
When a MultipleChoice question is displayed to the user, the choices must appear so that the user can choose one of them.
Task 1:
Construct a UML diagram to indicate the class attributes and methods
Task 2:
Code the class.
Task 3:
Write a test application to allow the user to answer two types of questions.