package protriangulo;
public class Triangulo {
double base;
double altura;
public Triangulo() {
this.base = 0;
this.altura = 0;
}
public Triangulo(double base, double altura) {
this.base = base;
this.altura = altura;
}
public double getBase() {
return base;
}
public void setBase(double base) {
this.base = base;
}
public double getAltura() {
return altura;
}
public void setAltura(double altura) {
this.altura = altura;
}
public double area() {
return this.base*altura/2;
}
@Override
public String toString() {
return "Triangulo{" + "base=" + base + ", altura=" + altura + '}';
}
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.