You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
680 B
32 lines
680 B
package com.rental.shape;
|
|
|
|
public class Rectangle extends Shape {
|
|
private double width;
|
|
private double height;
|
|
|
|
public Rectangle(double width, double height) {
|
|
this.width = width;
|
|
this.height = height;
|
|
}
|
|
|
|
@Override
|
|
public void draw() {
|
|
System.out.println("绘制一个宽为" + 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;
|
|
}
|
|
}
|