Question: Python Program I have 4 python files with 1 file being a superclass called Bug and the next 2 files being subclasses which are Grasshopper
Python Program
I have python files with file being a superclass called Bug and the next files being subclasses which are Grasshopper and Spider.
The number file is a Tester subclass.
The file cannot run because of errors, what am I missing in order to make these python files run?
Bug.py superclass
class Bug:
def initself name, numlegs, numwings:
self.name name
self.numlegs numlegs
self.numwings numwings
def getnameself:
return self.name
def setnameself name:
self.name name
def getnumlegsself:
return self.numlegs
def setnumlegsself numlegs:
self.numlegs numlegs
def getnumwingsself:
return self.numwings
def setnumwingsself numwings:
self.numwings numwings
def strself:
return fThis is a selfname It has selfnumlegs legs and selfnumwings wings."
Grasshopper.py subclass
from Bug import Bug
class GrasshopperBug:
def initself:
superinitGrasshopper
def strself:
message superGrasshopper selfstr
message
Grasshoppers are common in the Everglades and play a vital role in the ecosystem."
return message
Spider.py subclass
from Bug import Bug
class SpiderBug:
def initself:
superSpider selfinitSpider
def strself:
message superSpider selfstr
message
The golden orb weaver has a mild venom that is not poisonous to humans."
return message
Tester.py subclass
from Bug import Bug
from Grasshopper import Grasshopper
from Spider import Spider
class Tester:
def initself:
self.bug BugMillipede
self.spider Spider
self.grasshopper Grasshopper
#Step Print out the message statement for all bugs
def printinfoself:
printselfbug
printselfspider
printselfgrasshopper
tester Tester
tester.printinfo
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
