Task - 4 Write the Mango and the Jackfruit classes so that the following code generates the output below: class Fruit: OUTPUT: ----Printing Detail-- Do not eat the Mango. Mangos are bad for you...


Solve using Python3 and Inheritance method



Task - 4<br>Write the Mango and the Jackfruit classes so that the following code generates the output<br>below:<br>class Fruit:<br>OUTPUT:<br>----Printing Detail--<br>Do not eat the Mango.<br>Mangos are bad for you<br>----Printing Detail-----<br>Eat the Jackfruit.<br>def _init_(self, formalin=False, name=''):<br>self._formalin = formalin<br>self.name = name<br>def getName (self):<br>return self.name<br>Jackfruits are good for you<br>def hasFormalin(self):<br>return self._formalin<br>class testFruit:<br>def test(self, f):<br>print('----Printing Detail----')<br>if f.hasFormalin():<br>print('Do not eat the',f.getName(),'.')<br>print(f)<br>else:<br>print('Eat the',f.getName(),'.')<br>print(f)<br>Mango()<br>j = Jackfruit()<br>testFruit()<br>t1.test (m)<br>t1.test(j)<br>m =<br>%3D<br>t1 =<br>

Extracted text: Task - 4 Write the Mango and the Jackfruit classes so that the following code generates the output below: class Fruit: OUTPUT: ----Printing Detail-- Do not eat the Mango. Mangos are bad for you ----Printing Detail----- Eat the Jackfruit. def _init_(self, formalin=False, name=''): self._formalin = formalin self.name = name def getName (self): return self.name Jackfruits are good for you def hasFormalin(self): return self._formalin class testFruit: def test(self, f): print('----Printing Detail----') if f.hasFormalin(): print('Do not eat the',f.getName(),'.') print(f) else: print('Eat the',f.getName(),'.') print(f) Mango() j = Jackfruit() testFruit() t1.test (m) t1.test(j) m = %3D t1 =

Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here