How do I calculate the perimeter of a triangle in java? I do not know how to calculate the perimeter of a triangle in java, anyone know? I already tried but could not, help me!
How do I calculate the perimeter of a triangle in java? I do not know how to calculate the perimeter of a triangle in java, anyone know? I already tried but could not, help me!
public class Triangulo {
private final double lado1;
private final double lado2;
private final double lado3;
public Triangulo(double lado1, double lado2, double lado3) {
this.lado1 = lado1;
this.lado2 = lado2;
this.lado3 = lado3;
}
public double getPerimetro() {
return lado1 + lado2 + lado3;
}
@Override
public String toString() {
return "Triangulo [lado1=" + lado1 + ", lado2=" + lado2 + ", lado3=" + lado3 + "]";
}
}