<?php require 'triangle.php'; $triangle = new Triangle(); $triangle->setX1(10); $triangle->setY1(25); $triangle->setX2(45); $triangle->setY2(75); $triangle->setX3(32); $triangle->setY3(115); $triangle->drawAndMoveTriangle(15); $triangle->displayImage();
public function getY3() { return $this->y3; } public function display() { parent::display(); // TODO: Change the autogenerated stub echo "x3=" . $this->x3 . "</br>"; echo "y3=" . $this->y3 . "</br>"; } } $tr = new Triangle(); $tr->setX1(4); $tr->setY1(6); $tr->setX2(5); $tr->setY2(7); $tr->setX3(8); $tr->setY3(0); $tr->display(); class Rectangle extends Triangle { public $x4; public $y4; public function setX4($x4) { settype($x4, "integer"); $this->x4 = $x4; } public function getX4() {
<?php require 'triangle.php'; $myTriangle = new Triangle(); $myTriangle->setX1(10); $myTriangle->setY1(25); $myTriangle->setX2(45); $myTriangle->setY2(75); $myTriangle->setX3(32); $myTriangle->setY3(115); echo "Triangle methods: </br>"; echo "Area: " . $myTriangle->calcArea();