Last active
August 29, 2015 13:57
-
-
Save gabrielbiga/9369282 to your computer and use it in GitHub Desktop.
Circulo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Circulo | |
* com.gsoft.Circulo | |
* | |
* Operacoes com circulo | |
* | |
* 05/03/2014 @ 12:15:20 PM | |
* Copyright (C) 2014 Gsoft do Brasil Sistemas | |
* | |
* @author Gabriel Marinho <[email protected]> | |
*/ | |
package circulo; | |
import static java.lang.Math.PI; //Implementa constante PI | |
/** | |
* | |
* @author Gabriel Marinho <[email protected]> | |
*/ | |
public class Circulo { | |
private double raio; | |
//Construtor | |
public Circulo(double R) { | |
this.raio = R; | |
} | |
public double calcularArea() { | |
//Formula: PI * R² | |
return PI * Math.pow(this.raio, 2); | |
} | |
public double calcularDiametro() { | |
//Forumula: 2 * R | |
return 2 * this.raio; | |
} | |
public double calcularPerimetro() { | |
//Foruma: PI * Diametro | |
return PI * this.calcularDiametro(); | |
} | |
public double getRaio() { | |
return this.raio; | |
} | |
public void setRaio(double raio) { | |
this.raio = raio; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment