Last active
July 11, 2017 00:44
-
-
Save alcidesjunior/5758e255d69b7717824bb950c72aca76 to your computer and use it in GitHub Desktop.
codigo da coroa circular
This file contains hidden or 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
public class Main { | |
public static void main(String[] args){ | |
CoroaCircular cc = new CoroaCircular(10,8); | |
System.out.println(cc.calAreaCC()); | |
} | |
} | |
public class AreaCirculo{ | |
public double calcArea(double raio){ | |
return Math.pow(raio,2)*(Math.PI); | |
} | |
} | |
public class CoroaCircular extends AreaCirculo{ | |
private double raioMaior, raioMenor; | |
private double pi = 3.14; | |
public CoroaCircular(double r1, double r2) { | |
this.raioMaior = r1; | |
this.raioMenor = r2; | |
} | |
public double calAreaCC(){ | |
return super.calcArea(this.raioMaior) - super.calcArea(this.raioMenor); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment