diff --git a/instructions.md b/instructions.md new file mode 100644 index 0000000..e69de29 diff --git a/src/Circle.php b/src/Circle.php new file mode 100644 index 0000000..a6cda19 --- /dev/null +++ b/src/Circle.php @@ -0,0 +1,32 @@ +radius = $radius; + } + +/* +area method to calculate and return the area of the circle (PI x r x r) +*/ + public function area() { + $pi = pi(); + $area = $pi * pow($this->radius, 2); + return $area; + } + +/* +getFullDescription method to return string describing the shape +Uses getId() to get the Id because that's a protected property of the parent class +*/ + public function getFullDescription() { + return get_class($this) . '<#' . $this->getId() . '>: ' . $this->name . ' - ' . $this->radius; + } +} diff --git a/src/Rectangle.php b/src/Rectangle.php new file mode 100644 index 0000000..acdcc24 --- /dev/null +++ b/src/Rectangle.php @@ -0,0 +1,7 @@ +length = $length; + $this->width = $width; + $this->id = uniqid(); + } + +/* +Getter and Setter methods for $name property +*/ + function getName() { + return $this->name; + } + + function setName($name) { + $this->name = $name; + return $name; + } + +/* +Getter method for $id property +*/ + function getId() { + return $this->id; + } + +/* +Area method to calculate and return the area of the Shape object +*/ + public function area() { + $area = $this->length * $this->width; + return $area; + } + +/* +getTypeDescription method to return the shape type +*/ + public static function getTypeDescription() { + return 'Type: ' . static::SHAPE_TYPE; + } + +/* +getFullDescription method to return string describing the shape +*/ + public function getFullDescription() { + return get_class($this) . '<#' . $this->id . '>: ' . $this->name . ' - ' . $this->length . ' x ' . $this->width; + } + +}