Beispiel #1
0
class TwoDShape(Thing):
    def __init__(self):
        super(TwoDShape, self).__init__()
        self.perimeter = Disp(u='units')
        self.area = Area()

    def __str__(self):
        s = self.ul_label()
        s += '{:>9} = {}\n'.format('Area', self.area_)
        s += '{:>9} = {}'.format('Perimeter', self.perimeter.to_scalar())
        return s

    @property
    def area_(self):
        return self.area

    @area_.setter
    def area_(self, fl):
        self.area = Area(fl)

    @property
    def perim(self):
        return self.perimeter

    @perim.setter
    def perim(self, fl):
        self.perimeter = Disp(fl)
Beispiel #2
0
 def perim(self, fl):
     self.perimeter = Disp(fl)
Beispiel #3
0
 def __init__(self):
     super(TwoDShape, self).__init__()
     self.perimeter = Disp(u='units')
     self.area = Area()