编辑代码

public class ND {
    double width, height;
    double area, zhou;
    ND(double x) {
        width = x;
        height = x;
    }
    ND(double w, double hei) { 
        width = w;
        height = hei;
    }
    public double zhouND() {
        zhou = (width + height) * 2;
        return zhou;
    }
    public double areaND() {
        area = width * height;
        return area;
    }
    public static void main(String[] args) { 
        double c, s;
        ND ND1 = new ND(11, 34);
        ND ND2 = new ND(18);
        c = ND1.zhouND();
        s = ND2.areaND();
        System.out.println("周长是:" + c);
    System.out.println("面积是:" + s);
     
    }
}