package InterfaceDemo; /** * TriangularCrossSection.java * * * Created: Tue Feb 13 20:49:03 2001 * * @author Stuart C. Shapiro * * The class of triangular cross sections. */ public class TriangularCrossSection extends CrossSection{ /** The length of this cross section. */ private double base, /** The width of this cross section. */ height; /** * Constructs a triangular cross section. * @param l The length of this triangular cross section. * @param w The width of this triangular cross section. */ public TriangularCrossSection (double b, double h){ base = b; height = h; } /** Returns the area of this triangular cross section. */ public double getArea(){ return (base * height) / 2.0; } }// TriangularCrossSection