public class Rectangle {
double width, height;
double area, zhou;
Rectangle(double x) {
width = x;
height = x;
}
Rectangle(double w, double hei) {
width = w;
height = hei;
}
public double zhouRectangle() {
zhou = (width + height) * 2;
return zhou;
}
public double areaRectangle() {
area = width * height;
return area;
}
public static void main(String[] args) {
double c, s;
Rectangle Rectangle1 = new Rectangle(10, 20);
Rectangle Rectangle2 = new Rectangle(8);
c = Rectangle1.zhouRectangle();
s = Rectangle2.areaRectangle();
System.out.println("周长是:" + c);
System.out.println("面积是:" + s);
}