Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In python only Consider the following class diagram and the definition of question class in a module named questions and the definition of class Choice

In python only
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Consider the following class diagram and the definition of question class in a module named "questions" and the definition of class Choice Question in a module named choicequestions Question FAHIN Question Choice Question Numeric Question Free Response Question MultiChoice Question # This module defines a class that models exam questions. ## A question with a text and an answer. class Question : def init__(self, t="", a=""): self. text = t self. answer - a def setText (self, questionText): self._text = questionText def setAnswer (self, correctResponse) : self._answer = correctResponse def checkAnswer (self, response) : return response == self._answer def display (self) : print (self._text) def repr_(self): return "Question [%s, %5]" % (self._text, self._answer) from questions import Question class Choice Question (Question) : def init_(self, t="", a="") super().init(t,a) self._choices = 0 def addChoice (self, choice, correct) : self._choices.append(choice) if correct : # Convert len(choices) to string. choiceString = str(len (self._choices)) self.setAnswer (choiceString) def display (self) : super().display() # Display the answer choices. for i in range (len (self._choices)) : choiceNumber = i + 1 print("%d: (choiceNumber, self._choices[i])) 85" 1 Create a module named numericquestions. Inside the comdule create NumericQuestion class as a subclass of Question override the checkAnswer method such that if the response and the expected answer differ by no more than 0.01, then accept the response as correct. 2. Create a module named fillinquestions. Inside the comdule create FillinQuestion class as a subclass of Question Such a question is constructed with a string that contains the answer, surrounded by _ _, for example, "The inventor of Python was_Guido van Rossum_". The question should be displayed as The inventor of Python was 3. Create a module named multichoicequestion. Inside the mdule create a Multichoice Question class as a subclass of ChoiceQuestion. The MultiChoice Question allows multiple correct choices. The respondent (exam taker) should provide all correct choices, separated by spaces. Provide instructions in the question text. 4. Add a method named addText to the Question superclass that appends text to the question text and provide a different implementation of Choice Question that calls addText rather than storing a list of choices 5. Create a module named exammanegers. Inside the module, create a class named ExamManager An Exam Manager object stores Questions. It uses a list to store questions. It has a method for adding a Question message. The newly added question to be appended to the end of the list It has a method for returning the question found at a given index. Implement the necessary constructor. Each attribute must have a getter method. 6. Add a module named main. Inside the module, create a main method that Creates an Exam Manager object Creates 10 different questions of different types, and adds them to the exam manager object use a proper loop to display questions stored in the Exammanager object

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

Oracle Database Foundations Technology Fundamentals For IT Success

Authors: Bob Bryla

1st Edition

0782143725, 9780782143720

More Books

Students also viewed these Databases questions