Anonymous
public java v1 · immutable/* * Calculates Area and Perimeter of Square */public class Square { private double width; /* * Constructs the Square * @param theWidth Width of the square */ public Square(double theWidth) { this.width = theWidth; } /* * Returns the area of the square * @return Area of the Square */ public double getArea() { return this.width * this.width; } /* * Returns the perimeter of the square * @return Perimeter of the Square */ public double getPerimeter() { return 4 * this.width; }}