Solve using Python3 and Inheritance method
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 =
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here