You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
332 B
15 lines
332 B
public class Triangle extends Shape {
|
|
private double a, b, c;
|
|
|
|
public Triangle(double a, double b, double c) {
|
|
this.a = a;
|
|
this.b = b;
|
|
this.c = c;
|
|
}
|
|
|
|
@Override
|
|
public double getArea() {
|
|
double p = (a + b + c) / 2;
|
|
return Math.sqrt(p * (p - a) * (p - b) * (p - c));
|
|
}
|
|
}
|