Cone of volume using the OOP of php

Cone of volume using the OOP of php

using accesser method,property,

[php]

<?php
class Cone1{
const PI = 3.14;
private $radius;
private $height;

public function setRadius($base){
$this->radius = $base;
}
public function setHeight($height){
$this->height = $height;
}
public function getRadius(){
return $this->radius;
}
public function getHeight(){
return $this->height;
}
///
public function getVolume(){
$area = pow($this->radius,2) * self::PI;
return $area * $this->height / 3;
}
}

?>
[/php]





The volume of the cone


use OOP of PrivateAccesser



require_once 'Cone1.php';
$obj = new Cone1();
$obj->setRadius(10);
$obj->setHeight(50);
print "The bottom surface of the radius: {$obj->getRadius()}" . '
';
print "The height of the cone: {$obj->getHeight()}" . '
';

    print "The volume of the cone: {$obj->getVolume()}";
   ?>
</p>