update:demo2

This commit is contained in:
dichgrem
2025-10-31 17:01:12 +08:00
parent af1ea3e24e
commit d765c1a219
8 changed files with 214 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
package com.study.demo2;
public class Rectangle {
private double width = 1.0;
private double height = 1.0;
public Rectangle() {}
public Rectangle(double width, double height) {
this.width = width;
this.height = height;
}
public double getArea() {
return width * height;
}
public double getPerimeter() {
return 2 * (width + height);
}
public double getWidth() {
return width;
}
public void setWidth(double width) {
this.width = width;
}
public double getHeight() {
return height;
}
public void setHeight(double height) {
this.height = height;
}
}