public class Test {
public static void main(String[] args) {
Rectangle rectangle = new Rectangle(30, 40);
double computCircum = rectangle.computCircum();
System.out.println("computCircum = " + computCircum);
double computArea = rectangle.computArea();
System.out.println("computArea = " + computArea);
}
}
class Rectangle {
private double width;
private double height;
public Rectangle() {
}
public Rectangle(double width, double height) {
this.width = width;
this.height = height;
}
public double computCircum() {
return (width + height) * 2;
}
public double computArea() {
return width * height;
}
}