1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- /**
- * Created by PhpStorm.
- * User: mrs
- * Date: 28.12.2017
- * Time: 10:33
- */
- require_once('AbstractCircle.php');
- class Circle extends CircleFigure
- {
- public $pointCenter;
- public $radius = 0;
- public $area = 0;
- public $circumference = 0;
- public function __construct(int $x1, int $y1, int $x2, int $y2, float $radius)
- {
- $this->x1 = $x1;
- $this->y1 = $y1;
- $this->x2 = $x2;
- $this->y2 = $y2;
- $this->radius = $radius;
- }
- public function getCoordinatesCenter(): array
- {
- return $this->pointCenter->coordinatesPoint;
- }
- public function printCoordinatesCenter(): void
- {
- echo "Координаты центра круга (x = " . $this->pointCenter->coordinatesPoint['x'] . ", y = " . $this->pointCenter->coordinatesPoint['y'];
- }
- public function getArea(): float
- {
- $area = round(M_PI * $this->radius ** 2, 2);
- return $this->area = $area;
- }
- public function printArea(): void
- {
- echo "Площадь круга равна " . $this->area;
- }
- public function getCircumference(): float
- {
- $circumference = round((2 * M_PI * $this->radius), 2);
- return $this->circumference = $circumference;
- }
- public function printCircumference(): void
- {
- echo "Длина окружности равна " . $this->circumference;
- }
- }
|