-
Notifications
You must be signed in to change notification settings - Fork 0
/
Circulo.php
78 lines (56 loc) · 1.1 KB
/
Circulo.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/**
* Created by PhpStorm.
* User: edgar
* Date: 6/10/15
* Time: 17:43
*/
namespace Figura;
require_once 'Figura.php';
require_once 'Punto.php';
class Circulo extends Figura
{
/*
*@var float
*/
private $radio;
/*
*@param Punto $origen
*@param $radio
*/
function __construct(Punto $origen, $radio)
{
parent::__construct($origen);
$this->radio = $radio;
}
/**
* @return mixed
*/
public function getRadio()
{
return $this->radio;
}
/**
* @param mixed $radio
*/
public function setRadio($radio)
{
$this->radio = $radio;
}
public function area()
{
return Math . PI * Math . pow($this->radio, 2);
}
public function perimetro()
{
return Math . sqrt(Math . pow($this . altura, 2) + Math . pow($this . base / 2, 2) * 2 + $this . base);
}
public function escalar($d)
{
$this->radio = $this->radio * $d;
}
public function __toString()
{
return "Circulo { radio " . $this->radio . " }";
}
}