Ejemplo n.º 1
0
<?php

require_once './src/shape.php';
require_once './src/circle.php';
require_once './src/cone.php';
require_once './src/cylinder.php';
$shape1 = new shape(3, 4, "niebieski");
$shape2 = new shape(6, 8, "czerwony");
$shape1->printInfo();
echo $shape1->distance($shape2);
$circle1 = new Circle(3, 4, "red", 5);
$circle2 = new Circle(6, 8, "blue", 2);
$circle1->printInfo();
echo "Odleglosc miedzy srodkami kol = " . $circle1->distance($circle2) . "<br><br>";
echo "Pole kola = " . $circle1->getArea() . "<br><br>";
echo "Obwod kola = " . $circle1->getPir() . "<br><br>";
$cone = new Cone(9, 12, "green", 5, 15);
$cone->printInfo();
echo "Pole stozka = " . $cone->getArea() . "<br><br>";
echo "Objetosc stozka = " . $cone->getVol() . "<br><br>";
$cylinder = new Cylinder(12, 16, "green", 10, 20);
$cylinder->printInfo();
echo "Pole walca = " . $cylinder->getArea() . "<br><br>";
echo "Objetosc walca = " . $cylinder->getVol() . "<br><br>";
Ejemplo n.º 2
0
/**
 * 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>';
unset($c, $s, $circle);
echo '<p>Circles left: ' . Circle::getCounter() . '</p>';