-
Notifications
You must be signed in to change notification settings - Fork 0
/
POO02Circunferencia.java
57 lines (48 loc) · 1.33 KB
/
POO02Circunferencia.java
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
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package luco;
import static java.lang.Math.PI;
/**
*
* @author Usuario
*/
public class POO02Circunferencia {
private double radio;
public POO02Circunferencia(double radio) {
this.radio = radio;
}
//ahh este de abajo es el constructor vacio
public POO02Circunferencia() {
}
public double getRadio() { //no void sino double
return this.radio;
}
//algo de encapsular
public void setRadio(double radio) {
this.radio = radio;
}
public void crearCircunferencia(double radio) {
this.radio = radio;
}
//abstraer?
public double getArea(){
double area;
area = PI * Math.pow(this.radio, 2);
return area;
}
public double getPerimetro(){
double perimetro;
perimetro = 2 * PI * this.radio;
return perimetro;
}
//constructor comun?
// public POO02Circunferencia(int radio, double area, double circunferencia) {
// this.radio = radio;
// this.area = area;
// this.circunferencia = circunferencia;
}
//Area = π ∗ radio!
//Perimetro = 2 ∗ π ∗ radio