Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use java Implement the Strategy pattern for quizzes/exams that have multiple types of questions. This assignment focuses on following the pattern, so dont worry about

Use java

Implement the Strategy pattern for quizzes/exams that have multiple types of questions.

  • This assignment focuses on following the pattern, so dont worry about error-checking (like case sensitivity, whether there are any underscores in a FillIn question)
  • You need to implement the following in the package school
    • Question: the Strategy interface for this assignment
      • Placed in the package school.assessment
      • This interface has a function mark(String ans) that returns true if its parameter is the correct answer, false if not
    • MultipleChoice: a concrete child class of Question
      • The constructor takes 3 parameters:
        • The String text to display to the user taking the quiz/exam
          • Ex: On which continent is the country of India?
        • A List for the possible answers to display
          • Ex: {Asia, Africa, Europe}
        • A String for the correct answer
          • Ex: Asia
      • The ans parameter for mark() is the answer chosen by a test taker, and mark() compares it to the correct answer set in the constructor
      • Override toString() to return a String with the text followed by each possible answer on a separate line
    • FillIn: a concrete child class of Question
      • The constructor takes 2 parameters:
        • The String text to display to the user taking the quiz/exam
          • Ex: University is in the city of _______
        • A String for the correct answer
          • Ex: Jersey City
      • The mark()returns true if the parameter equals the correct answer, false if not
      • Override toString() to return a String with the text to display
    • Quiz: a concrete class that contains a bunch of Question objects. It supports:
      • void add(Question question) to add a question to the quiz
      • int grade(List answers) to return the number of correct answers in the parameter

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2022 Grenoble France September 19 23 2022 Proceedings Part 4 Lnai 13716

Authors: Massih-Reza Amini ,Stephane Canu ,Asja Fischer ,Tias Guns ,Petra Kralj Novak ,Grigorios Tsoumakas

1st Edition

3031264118, 978-3031264115

More Books

Students also viewed these Databases questions

Question

Psychological, financial, and career counseling.

Answered: 1 week ago