色婷婷狠狠18禁久久YY,CHINESE性内射高清国产,国产女人18毛片水真多1,国产AV在线观看

有沒有會Java的來幫幫我

夏志豪2年前17瀏覽0評論

有沒有會Java的來幫幫我?

public interface Shape {

double area();

double perimeter();

}

public class Circle implements Shape{

private static double PI = Math.PI;

private double radius;

public Circle(double radius) {

this.radius = radius;

}

@Override

public double area() {

return PI * Math.pow(radius,2);

}

@Override

public double perimeter() {

return 2 * PI * radius;

}

}

public class Rectangle implements Shape{

private double longth;

private double width;

public Rectangle(double longth, double width) {

this.longth = longth;

this.width = width;

}

@Override

public double area() {

return longth * width;

}

@Override

public double perimeter() {

return 2 * (width + longth);

}

}

public class TestMain {

public static void main(String[] args) {

Shape circle = new Circle(1.5);

System.out.println("圓面積:"+circle.area());

System.out.println("圓周長:"+circle.perimeter());

Shape rectangle = new Rectangle(1.5, 3);

System.out.println("矩形面積:"+rectangle.area());

System.out.println("矩形長:"+rectangle.perimeter());

}

}

java 上機(jī)題,有沒有會Java的來幫幫我