import java.util.*;
abstract class GeometricObject{
private String color;
private boolean filled;
public String getColor()
{ return color; }
public void setColor(String color)
{ this.color = color; }
public boolean isFilled()
{ return filled; }
public void setFilled(boolean filled)
{ this.filled = filled; }
public abstract double getArea();
public abstract double getPerimeter();
}
class Triangle extends GeometricObject{
private double oneSide;
private double twoSide;
private double threeSide;
public void setOneSide(double oneSide) {
this.oneSide = oneSide;
}
public void setTwoSide(double twoSide)
{ this.twoSide = twoSide; }
public void setThreeSide(double threeSide)
{ this.threeSide = threeSide; }
public double getArea()
{
double p = (oneSide + twoSide +threeSide) / 2; return Math.sqrt(p * (p - oneSide) * (p - twoSide) * (p - threeSide) );
}
public double getPerimeter()
{ return oneSide + twoSide + threeSide; }
public String toString()
{ return "area = " + getArea() + " perimeter" + getPerimeter() + " color = " + getColor() +" isFalled = " + isFilled(); }
}
public class title13_1
{
public static void main(String[] args)
{ Triangle value = new Triangle();
System.out.println("请用户输入第一个三角形边:");
Scanner input = new Scanner(System.in);
value.setOneSide(input.nextDouble());
System.out.println("请用户输入第二个三角形边:");
value.setTwoSide(input.nextDouble());
System.out.println("请用户输入第三个三角形边:");
value.setThreeSide(input.nextDouble());
System.out.println("请用户输入颜色:");
value.setColor(input.next());
System.out.println("请用户输入是否填充:");
value.setFilled(input.nextBoolean());
System.out.println("最后结果: " + value.toString());
}
}