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.Square;
/**
* 可缩放的正方形(实现Shape和Resizable)
*/
public class ResizableSquare extends Square implements Resizable {
public ResizableSquare(String color, double side) {
super(color, side);
}
@Override
public void resize(double factor) {
if (factor <= 0) {
throw new IllegalArgumentException("缩放因子必须为正数");
setSide(getSide() * factor); // 调整边长