/** A RightTriangle with a base point, width and height. @author Greg Vogl last modified 2003-10-14 */ public class RightTriangleShape extends RectangleShape { // constructors public RightTriangleShape() { super(); } public RightTriangleShape(double width, double height) { super(width, height); } public RightTriangleShape(double x, double y, double width, double height) { super(x, y, width, height); } // calculations public double area() { return super.area() / 2; } public double perimeter() { double w = width(); double h = height(); return w + h + Math.sqrt(w * w + h * h); } // toString is same as superclass, not needed }