Created
March 25, 2019 20:29
-
-
Save danicunhac/c8ae58d8777aad420d3acdf4c0362ab7 to your computer and use it in GitHub Desktop.
Calculo da Area
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
public class Aplicacao { | |
public static void main(String[] args) { | |
double area; | |
Triangulo tri = new Triangulo(); | |
tri.b = 5; | |
tri.h = 3; | |
area = tri.calcularArea(); | |
System.out.println("Area do triangulo: " + area); | |
Quadrado q = new Quadrado(); | |
q.l = 4; | |
area = q.calcularArea(); | |
System.out.println("Area do quadrado: " + area); | |
Circunferencia c = new Circunferencia(); | |
c.r = 3; | |
area = c.calcularArea(); | |
System.out.println("Area da circunferencia: " + area); | |
Trapezio tra = new Trapezio(); | |
tra.B = 7; | |
tra.b = 4; | |
tra.h = 5; | |
area = tra.calcularArea(); | |
System.out.println("Area do trapezio: " + area); | |
} | |
} |
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
public class Circunferencia { | |
double r; | |
double calcularArea() { | |
double area = (r*r)*Math.PI; | |
return area; | |
} | |
} |
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
public class Quadrado { | |
double l; | |
double calcularArea() { | |
double area = l*l; | |
return area; | |
} | |
} |
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
public class Trapezio { | |
double B; | |
double b; | |
double h; | |
double calcularArea() { | |
double area = ((B+b)*h)/2; | |
return area; | |
} | |
} |
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
public class Triangulo { | |
double b; | |
double h; | |
double calcularArea() { | |
double area = b*h/2; | |
return area; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment