From b3b113a936030d51906fab5ae79e0dac50372fa7 Mon Sep 17 00:00:00 2001 From: "U-XZ-PC\\XZ" Date: Sat, 8 Oct 2016 12:55:52 -0400 Subject: [PATCH] tested locally --- src/Circle.php | 26 +++++++++++++++++++++++++ src/Rectangle.php | 5 +++++ src/Shape.php | 48 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 src/Circle.php create mode 100644 src/Rectangle.php create mode 100644 src/Shape.php diff --git a/src/Circle.php b/src/Circle.php new file mode 100644 index 0000000..5dbfbe2 --- /dev/null +++ b/src/Circle.php @@ -0,0 +1,26 @@ +radius = $circle_radius; + } + + function area (){ + $circle_area = pi() * $this->radius * $this->radius; + return $circle_area; + } + + public function getFullDescription (){ + $string = ""; + $string .= get_class($this)."<#"; + $string .= $this->getId(). ">: "; + $string .= $this->getName(). " - "; + $string .= $this->radius; + + return $string; + } +} +?> \ No newline at end of file diff --git a/src/Rectangle.php b/src/Rectangle.php new file mode 100644 index 0000000..a0e022e --- /dev/null +++ b/src/Rectangle.php @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/src/Shape.php b/src/Shape.php new file mode 100644 index 0000000..2160d4f --- /dev/null +++ b/src/Shape.php @@ -0,0 +1,48 @@ +length = $shape_length; + $this->width = $shape_width; + $this->id = uniqid(); + } + + function getName (){ + return $this->name; + } + + function setName($new_name){ + $this->name = $new_name; + } + + function getId() { + return $this->id; + } + function area (){ + $shape_area = $this->length * $this->width; + return $shape_area; + } + + static function getTypeDescription (){ + return ("Type: ".static::SHAPE_TYPE); + } + + public function getFullDescription (){ + $string = ""; + $string .= get_class($this)."<#"; + $string .= $this->getId(). ">: "; + $string .= $this->getName(). " - "; + $string .= $this->length. " x "; + $string .= $this->width; + + return $string; + } +} + + +?> \ No newline at end of file