Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python Project I have two python files 'Bug' and 'Spider', where 'Bug' is superclass and 'Spider' is a subclass that is referenced back to 'Bug'.

Python Project
I have two python files 'Bug' and 'Spider', where 'Bug' is superclass and 'Spider' is a subclass that is referenced back to 'Bug'.
Can you help me run the program by calling function and creating the correct output for Bug and Spider classes.
1. Bug.py file
class Bug:
def __init__(self, name, num_legs, num_wings):
self.name = name
self.num_legs = num_legs
self.num_wings = num_wings
def get_name(self):
return self.name
def set_name(self, name):
self.name = name
def get_num_legs(self):
return self.num_legs
def set_num_legs(self, num_legs):
self.num_legs = num_legs
def get_num_wings(self):
return self.num_wings
def set_num_wings(self, num_wings):
self.num_wings = num_wings
def __str__(self):
return f"This is a {self.name}. It has {self.num_legs} legs and {self.num_wings} wings."
2. Spider.py file
from Bug import Bug
class Spider(Bug):
def __init__(self):
super(Spider, self).__init__("Spider",8,0)
def __str__(self):
message = super(Spider, self).__str__()
message +="
The golden orb weaver has a mild venom that is not poisonous to humans."
return message

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

Database And Expert Systems Applications Dexa 2023 Workshops 34th International Conference Dexa 2023 Penang Malaysia August 28 30 2023 Proceedings

Authors: Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil ,Bernhard Moser ,Atif Mashkoor ,Johannes Sametinger ,Maqbool Khan

1st Edition

303139688X, 978-3031396885

More Books

Students also viewed these Databases questions