This blog presents the outline for a simple project implementing a quiz application. The application will consist of a series of multiple choice questions. The questions will be saved in a file using serialization.
Three classes will be built having the following members
- Class Question
- Fields(All fields will be private with getters.).
- Qno int
- Question String
- Option A String
- Option B String
- Option C String
- Option D String
- Correct Option int
- Explanation String. This will be shown while displaying the results in case of a wrong answer.
- Functions
- Constructor. Take all the inputs
- Display. Display the question
- Class QuestionsSupplier
- Fields
- questions. Array of Questions
- total questions. int
- current question no int
- Functions
- Constructor. Initialize questions array, set total questions and initialize current question no.
- previous. Return the previous question if it exists otherwise throw exception
- next. Get the next question if it exists otherwise exception.
- getQuestionByQuestionNo. This will get question by question no.