public class Triangolo implements OggettoGeometrico {
  private double a, b, c;
    
  public Triangolo(double a, double b, double c) {
    this.a = a;
    this.b = b;
    this.c = c;
  }
  
  public double getA() { return this.a; }
  public double getB() { return this.b; }
  public double getC() { return this.c; }
  
  public double getPerimetro() {
    return this.a + this.b + this.c;
  }
  
  public double getArea() {
    double p = this.getPerimetro()/2;
    return Math.sqrt(p*(p-this.a)*(p-this.b)*(p-this.c));
  }
  
  public boolean equals(Object obj) {
    if(obj == null)
      return false;
    else if(!(obj instanceof Triangolo))
      return false;
    else {
      Triangolo altro = (Triangolo)obj;
      if((this.a == altro.a) && (this.b == altro.b) && (this.c == altro.c))
        return true;
      else
        return false;
    }
  }
  
  public String toString() {
    return "Triangolo: " + this.a + ", " + this.b + ", " + this.c + ".";
  }
}