1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ASHA 777 [7]
2 years ago
9

Add a subclass FillInQuestion to the question hierarchy of Section 10.1. Such a question is constructed with a string that conta

ins the answer, surrounded by _ _, for example, "the inventor of Python was _Guido van Rossum_". The question should be displayed as 6 pts
The inventor of Python was _______
Below is the program that runs the modified class Question:
##
# Demonstrate the FillInQuestion class.
#
# Create the question and expected answer.
q = FillInQuestion()
q.setText("The inventor of Python was _Guido van Rossum_")
# Display the question and obtain user's response.
q.display()
response = input("Your answer: ")
print(q.checkAnswer(response))
a) Your code with comments
b) A screenshot of the execution
Identify the superclass and subclass in each of the following pairs of classes.
a) Employee, Manager
b) Student, GraduateStudent
c) Employee, Professor
d) Truck, Vehicle
use python to programe this Q and please make sure to include the commenst in the coding and make sure do not copy and past here i saw all the answers here in chegg but not what i want, and show me screenshot of the output
Computers and Technology
1 answer:
sattari [20]2 years ago
3 0

Answer:

class Question:

   def __init__(self):

       self.text = ""

       self.answer = ""

   def setText(self,text):

       self.text = text

   def setAnswer(self,answer):

       self.answer = answer

   def display(self):

       print(self.text)

   def checkAnswer(self,response):

       ans = self.answer.replace(' ','')

       ans = ans.lower()

       response = response.replace(' ','')

       response = response.lower()

       if(response == ans):

           return "Correct answer"

       else:

           return "Wrong answer"

class FillInQuestion (Question):

   def __init__(self):

       super(Question, self).__init__()

   def setText(self,text):

       temp = text.split("_")

       temp[0] = temp[0] + "_______"

       super(FillInQuestion,self).setText(temp[0])

       super(FillInQuestion, self).setAnswer(temp[1])

def main():

   # Create the question and expected answer.

   q = FillInQuestion()

   q.setText("The inventor of Python was _Guido van Rossum_")

   # Display the question and obtain user's response.

   q.display()

   response = input("Your answer: ")

   print(q.checkAnswer(response))

main()

Explanation:

The python program defines two classes, a parent class called Question and a child class called FillInQuestion. The screen shot of the output is seen below.

You might be interested in
"The _____ of the Open Systems Interconnection (OSI) model generates the receiver’s address and ensures the integrity of message
aleksklad [387]

Answer:

The transport layer

Explanation: Layer 4, is the transport layer of the Open System Interconnection (OSI), that handles message transfer of data between end systems or hosts and ensures complete packets transfer.

7 0
2 years ago
Read 2 more answers
Does a newer game work on older computer
babunello [35]
I don't think so because the old computers may have not been to date as what we have now but check it out and see.
5 0
3 years ago
Which type of network topology is the most common and easiest to use?
Airida [17]
<span>A network layout or topology that is the most common, the most simple and easiest to use out of the four network topologies is the Bus topology, one cable is used for installation so it is also the cheapest network type.</span>
5 0
3 years ago
Write a method that takes a RegularPolygon as a parameter, sets its number of sides to a random integer between 10 and 20 inclus
Sergio [31]

Answer:

import java.lang.Object

import java.lang.Math

public class RegularPolygon  extends java.lang.Object{

  public void randomize(RegularPolygon c){

       int min = 10, max1 = 20;

       double  min1 = 5, max1 = 12;

       double range = (max - min) + 1;

       double range1 = (max1 -min1) + 1

       int side = (Math.random() * range) + min;

       double len = (Math.random() * range1) + min1;

       c.setNumSides(side);

       c.setSideLength( len);

 }

 public static void main(String[] args) {

    RegularPolygon r = new RegularPloygon();

    randomize(r);

 }

}

Explanation:

The randomize method accepts a regular polygon class as its only parameter and assigns a random number of sides and the length of these sides with the 'Math.random' function.

5 0
3 years ago
A sample member of the list data is a1 = ['male', True] where the second item is True if the person is on the phone.
Ira Lisetskai [31]
Answer:

0

Explanation:
In the lists, indexation starts from 0, because of that in if statement we compare item[0] which is 'male' and 'male', and then males is itterated within for loop.
8 0
2 years ago
Read 2 more answers
Other questions:
  • The operating system is not directly involved in one of these tasks.Immersive Reader
    12·1 answer
  • Hot five was the famous band of which musician?
    14·1 answer
  • which virtue you need to secure information by limiting computer access to authorized personnel only?
    10·1 answer
  • Constraints are a. quantities to be minimized in a linear programming model. b. quantities to be maximized in a linear programmi
    5·1 answer
  • True or false A ClassB fire involves live electrical equipment
    5·1 answer
  • What is one method that can be used to open the Microsoft Word application?
    8·1 answer
  • If you are a member of a security penetration testing team, and you identify vulnerabilities and exploits, what should you obtai
    11·1 answer
  • A character with the point size of 10 is about 10/72 of once inch in height
    8·1 answer
  • Define get_date() function.
    6·1 answer
  • Unleashes the ability of each person on their team to improve performance, solve problems, and
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!