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.

24 lines
610 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package jinjieti;
import jichuti.Circle;
public class ResizableCircle extends Circle implements Resizable {
public ResizableCircle(String color, double radius) {
super(color, radius);
}
@Override
public void resize(double factor) {
if (factor <= 0) {
throw new IllegalArgumentException("缩放因子必须为正数");
}
// 注意需要在父类Circle中添加setRadius方法
setRadius(getRadius() * factor); // 调整半径
}
private void setRadius(double d) {
// TODO Auto-generated method stub
}
}