/* * Author: CHEN Yongyuan (Walter) 1930006025 from OOP(1007) * Date: 2022/03/27 * Description: Square class */ public class Square extends Rectangle { /** * Constructor * * @param x the x coordinate of the center of the square * @param y the y coordinate of the center of the square * @param size */ public Square(double x, double y, double size) { super(x, y, size, size); } /** * Test */ public static void testSquare() { Square s = new Square(1.0, 2.0, 3.0); System.out.println(s.getX() == 1.0); System.out.println(s.getY() == 2.0); System.out.println(s.area() == 9.0); } }