You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
484 B
18 lines
484 B
package w4.代码;
|
|
|
|
import w4.Rectangle;
|
|
import w4.Shape;
|
|
import w4.ShapeUtil;
|
|
import w4.Triangle;
|
|
|
|
public class Demo {
|
|
public static void main(String[] args) {
|
|
Shape circle = new Circle(5.0);
|
|
Shape rectangle = new Rectangle(4.0, 6.0);
|
|
Shape triangle = new Triangle(3.0, 4.0);
|
|
|
|
ShapeUtil.printArea(circle); // Area: 78.54
|
|
ShapeUtil.printArea(rectangle); // Area: 24.00
|
|
ShapeUtil.printArea(triangle); // Area: 6.00
|
|
}
|
|
}
|
|
|