Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can you read the following code and try to complete the TODO in class YesNoQuestion, class CheckboxQuestion, class Answer, and class Survey. If there is

Can you read the following code and try to complete the TODO in class YesNoQuestion, class CheckboxQuestion, class Answer, and class Survey. If there is any part that you are unsure about, mark it out if possible. Please upload screenshots or in proper indentation.

1. Can add any private attribute or functions needed

2. Can inherit from other class in file instead of Question if that is easier

Thank you so much!

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Python Console Problems D. Terminal Services d with pre-built Python packages shared indexes // Always download // Download once // Don't show again // Configure... (2023/3/1, 22:57 217:1 LF UTF-8 4 spaces Python 3.10 P Python packages shared indexes // Always download // Download once // Don't show again // Configure... (2023/3/1, 22:57 217:1 LF UTF-8 4 spaces Python 3.10 Lass NumericQuestion(Question): ... Lass YesNoQuestion: \# TODO: make this a child class of another class defined in this file ""A question whose answer is either yes (represented by True) or no (represented by False). ===PublicAttributes===id:theidofthisquestion text: the text of this question ===PrivateAttributes=== TODO: Describe any private attributes you create here def __str__(self) str: "" Return a string representation of this question including the the text of the question. You can choose the orecise format of this strina. ad with pre-built Python packages shared indexes // Always download // Download once // Don't show again // Configur... (2023/3/1, 22:57) 140:1 LF UTF-8 4 spaces Python 3.10 Z class Survey: "" "A survey containing questions as well as criteria and weights used to evaluate the quality of a group based on their answers to the survey questions. === Private Attributes === _questions: a dictionary mapping a question's id to the question itself _criteria: a dictionary mapping a question's id to its associated criterio _weights: a dictionary mapping a question's id to a weight -- an integer representing the importance of this criteria. === Representation Invariants === No two questions on this survey have the same id Each key in _questions equals the id attribute of its value The dictionaries_questions,_criteria, and_weights all have the same key: Each value in weights is greater than Problems D Terminal Services t Python packages shared indexes // Always download // Download once // Don't show again // Config... (2023/3/1, 22:57) 353:29 LF UTF-8 4 spaces Python 3.10 def get_questions(self) list[Question]: "" "Return a list of all questions in this survey "I" \# TODO: implement this method! def _get_criterion(self, question: Question) -> Criterion: "" "Return the criterion associated with int: "" "Return the weight associated with in this survey. Preconditions: - nn" \# TODO: implement this method! def set_weight(self, weight: int, question: Question) bool: "" "Set the weight associated with to and return True. If bool: "" "Set the criterion associated with to and return True

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

Spatial Databases A Tour

Authors: Shashi Shekhar, Sanjay Chawla

1st Edition

0130174807, 978-0130174802

More Books

Students also viewed these Databases questions

Question

3. I would allow members complete freedom in their work.

Answered: 1 week ago

Question

What is DDL?

Answered: 1 week ago