def main(x0, y0, x1, y1):
    rect = Rectangle(int(x0), int(y0), int(x1), int(y1))
    msg = "For the rectangle with corners located at ("
    msg += str(x0) + ", " + str(y0) + ") and ("
    msg += str(x1) + ", " + str(y1) + "):\n"
    print(msg)
    msg = "The length is " + str(rect.getLength())
    msg += " and the height is " + str(rect.getHeight()) + "."
    print(msg)
    msg = "The area is " + str(rect.getArea()) + "."
    print(msg)
Ejemplo n.º 2
0
def main(x0, y0, x1, y1):
    rect = Rectangle(int(x0), int(y0), int(x1), int(y1))
    msg = 'For the rectangle with corners located at ('
    msg += str(x0) + ', ' + str(y0) + ') and ('
    msg += str(x1) + ', ' + str(y1) + '):\n'
    print(msg)
    msg = 'The length is ' + str(rect.getLength())
    msg += ' and the height is ' + str(rect.getHeight()) + '.'
    print(msg)
    msg = 'The area is ' + str(rect.getArea()) + '.'
    print(msg)
Ejemplo n.º 3
0
class RectangleTest(TestCase):
    def setUp(self):
        self.rectangle = Rectangle(1, 2, 3, 4)

    def test_getLength(self):
        assert_equal(self.rectangle.getLength(), 2)

    def test_getHeight(self):
        assert_equal(self.rectangle.getHeight(), 2)

    def test_getArea(self):
        assert_equal(self.rectangle.getArea(), 4)

    def test_move(self):
        self.rectangle.move(4, 8)
        self.test_getLength()
        self.test_getHeight()
        self.test_getArea()
Ejemplo n.º 4
0
class RectangleTest(TestCase):

    def setUp(self):
        self.rectangle = Rectangle(1, 2, 3, 4)

    def test_getLength(self):
        assert_equal(self.rectangle.getLength(), 2)

    def test_getHeight(self):
        assert_equal(self.rectangle.getHeight(), 2)

    def test_getArea(self):
        assert_equal(self.rectangle.getArea(), 4)

    def test_move(self):
        self.rectangle.move(4, 8)
        self.test_getLength()
        self.test_getHeight()
        self.test_getArea()