NTU-OOP-Tuts-2025-1/T5Q3/src/Triangle.java

11 lines
291 B
Java

public class Triangle extends Polygon {
public Triangle (String theName, float theWidth, float theHeight) {
super(theName, theWidth, theHeight) ;
this.polytype = KindofPolygon.POLY_TRIANG;
}
public float calArea() {
return 0.5f * width * height;
}
}