Example #1
0
    {
        return 6 * ($this->a * $this->a);
    }
    public function volume()
    {
        return $this->a * $this->a * $this->a;
    }
    public function mass()
    {
        return $this->r * $this->volume();
    }
}
$cube = new Cube(5, 4, 3);
$parallelepiped = new Parallelepiped(5, 4, 3, 10, 11);
$pyramid = new Pyramid(5, 4, 3, 10, 2);
$sphere = new Sphere(5, 4);
echo "---------------------------------------------------------------------------------------------------------------------<br>";
echo "Основне завдання : <br><br>";
echo "Куб : <br>";
echo "Площа - " . $cube->square() . "<br>";
echo "Об'єм - " . $cube->volume() . "<br>";
echo "Маса - " . $cube->mass() . "<br><br>";
echo "Параллелепіпед : <br>";
echo "Площа - " . $parallelepiped->square() . "<br>";
echo "Об'єм - " . $parallelepiped->volume() . "<br>";
echo "Маса - " . $parallelepiped->mass() . "<br><br>";
echo "Піраміда : <br>";
echo "Площа - " . $pyramid->square() . "<br>";
echo "Об'єм - " . $pyramid->volume() . "<br>";
echo "Маса - " . $pyramid->mass() . "<br><br>";
echo "Куля : <br>";
Example #2
0
<?php

/**
 * Created by PhpStorm.
 * User: ET
 * Date: 7/2/2015
 * Time: 3:34 PM
 */
function __autoload($class)
{
    include_once $class . '.php';
}
$s = new Sphere(23);
$o = new Oval(23, 11);
$c = new Cylinder(22, 7);
$circle = new Circle(12);
echo '<p>Radius of the circle is: ' . $circle->getRadius() . '</p>';
echo '<p>Circumference of the Circle: ' . $circle->getCircumference() . '</p>';
echo '<p>Area of the Circle: ' . $circle->getArea() . '</p>';
echo '-------------------------------------------';
echo '<p>Height of the Cylinder: ' . $c->getHeight() . '</p>';
echo '<p>Radius of the Cylinder: ' . $c->getRadius() . '</p>';
echo '<p>Area of the Cylinder: ' . $c->getArea() . '</p>';
echo '-------------------------------------------';
echo '<p>Area of the Oval: ' . $o->getArea() . '</p>';
echo '<p>Length of Semi-Major Axis of the Oval: ' . $o->getRadius() . '</p>';
echo '<p>Length of Semi-Minor Axis of the Oval: ' . $o->getRadius2() . '</p>';
echo '-------------------------------------------';
echo '<p>Area of the Sphere: ' . $s->getArea() . '</p>';
echo '-------------------------------------------';
echo '<p>Total Circle related created: ' . Circle::getCounter() . '</p>';