Browse Source

上传文件至 'w4'

main
Zhuhuairui 4 weeks ago
parent
commit
94dd680cab
  1. BIN
      w4/Circle.class
  2. 20
      w4/Circle.java
  3. BIN
      w4/Rectangle.class
  4. 30
      w4/Rectangle.java
  5. BIN
      w4/Shape.class

BIN
w4/Circle.class

Binary file not shown.

20
w4/Circle.java

@ -0,0 +1,20 @@
public class Circle extends Shape {
private double radius;
public Circle(double radius) {
this.radius = radius;
}
public double getRadius() {
return radius;
}
public void setRadius(double radius) {
this.radius = radius;
}
@Override
public double getArea() {
return Math.PI * radius * radius;
}
}

BIN
w4/Rectangle.class

Binary file not shown.

30
w4/Rectangle.java

@ -0,0 +1,30 @@
public class Rectangle extends Shape {
private double width;
private double height;
public Rectangle(double width, double height) {
this.width = width;
this.height = 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;
}
@Override
public double getArea() {
return width * height;
}
}

BIN
w4/Shape.class

Binary file not shown.
Loading…
Cancel
Save