Jelajahi Sumber

Abstract class geometric figure

bufon2211 6 tahun lalu
induk
melakukan
e7b159f6d7

+ 12 - 0
AbstractClass/AbstractArea.php

@@ -0,0 +1,12 @@
+<?php
+
+/**
+ * Created by PhpStorm.
+ * User: mrs
+ * Date: 28.12.2017
+ * Time: 10:11
+ */
+abstract class Area
+{
+    public abstract function getArea(): float;
+}

+ 22 - 0
AbstractClass/AbstractCircle.php

@@ -0,0 +1,22 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: mrs
+ * Date: 28.12.2017
+ * Time: 10:27
+ */
+
+abstract class CircleFigure
+{
+    public $pointCenter;
+    public $area;
+    public $circumference;
+
+
+    abstract public function getArea(): float;
+
+    abstract public function getCircumference(): float;
+
+    abstract public function getCoordinatesCenter(): array;
+
+}

+ 14 - 0
AbstractClass/AbstractCoordinates.php

@@ -0,0 +1,14 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: mrs
+ * Date: 28.12.2017
+ * Time: 9:24
+ */
+
+abstract class Coordinates
+{
+
+    public abstract function getCoordinates(): array;
+
+}

+ 26 - 0
AbstractClass/AbstractPolygon.php

@@ -0,0 +1,26 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: mrs
+ * Date: 28.12.2017
+ * Time: 13:01
+ */
+
+require_once('AbstractCoordinates.php');
+require_once('InterfacePerimeter.php');
+
+
+abstract class Polygon extends Coordinates implements Perimeter
+{
+
+    public $points;
+    public $lines;
+    public $segmentLength;
+    public $perimeter;
+
+    abstract public function getLines(): array;
+
+    abstract public function getSegmentLength(): float;
+
+    abstract public function getPerimeter(): float;
+}