Oct-23-2022, 02:52 AM
Hi! I have a problem in which a farmer want to calculate the area of a land when he buying a new land and to add at the existing one.
The shape of land are different, I reduce the shape at 3: circle, square and right angle.
I made a class for every shape
And extra if doesn't have a exactly form how should I do it? This part for me know is not very important, more important is the first part.
Thanks!
The shape of land are different, I reduce the shape at 3: circle, square and right angle.
I made a class for every shape
import math class Circle: def __init__(self,radius): self.radius = radius def area_circle(self): return math.pi*(self.radius**2) class Square: def __init__(self, side): self.side = side def area_square(self): return self.latura**2 class RightAngle: def __init__(self, width, length): self.width = width self.length = length def area_right_angle(self): return self.length * self.widthCan you help me to create the class farmer, I don't know how tie that 3 class with farmer class.
And extra if doesn't have a exactly form how should I do it? This part for me know is not very important, more important is the first part.
Thanks!