From c595be519a034601163c33887791956e5bad4586 Mon Sep 17 00:00:00 2001 From: Luojiale <2272532647@qq.com> Date: Sun, 29 Mar 2026 23:25:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E5=BD=A2=E9=9D=A2=E7=A7=AF=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E6=9C=BA=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- w4/Triangle.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 w4/Triangle.java diff --git a/w4/Triangle.java b/w4/Triangle.java new file mode 100644 index 0000000..2229680 --- /dev/null +++ b/w4/Triangle.java @@ -0,0 +1,14 @@ +public class Triangle extends Shape { + private double base; + private double height; + + public Triangle(double base, double height) { + this.base = base; + this.height = height; + } + + @Override + public double getArea() { + return 0.5 * base * height; + } +} \ No newline at end of file