From 060ff5dba2ab3389ad0a534b90c94af73d6b5bc9 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Fri, 23 Dec 2022 18:38:17 +0500 Subject: [PATCH] mycommit --- index.php | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 index.php diff --git a/index.php b/index.php new file mode 100644 index 0000000..01d2a37 --- /dev/null +++ b/index.php @@ -0,0 +1,63 @@ +side = $side; + } + public function getArea(){ + return $this->side ** 2; + } + public function getPerimeter(){ + return $this->side * 4; + } + +} +class Rectangle extends Figure{ + private $width; + private $height; + public function __construct($width,$height) { + $this->width = $width; + $this->height = $height; + } + public function getArea(){ + return $this->width * $this->height; + } + public function getPerimeter(){ + return $this->width * 2 + $this->height * 2; + } +} +class Circle extends Figure{ + private $radius; + public function __construct($radius) { + $this->radius = $radius; + } + public function getArea(){ + return round(pi() * ($this->radius ** 2),2); + } + public function getPerimeter(){ + return round(2 * pi() * $this->radius,2); + } +} +class Triangle extends Figure{ + private $base; + private $side1; + private $side2; + private $height; + public function __construct($base,$side1,$side2,$height) { + $this->base = $base; + $this->side1 = $side1; + $this->side2 = $side2; + $this->height = $height; + } + public function getArea(){ + return ($this->base * $this->height) / 2; + } + public function getPerimeter(){ + return $this->side1 + $this->side2 + $this->base; + } +} \ No newline at end of file