// SquareTest class public class SquareTest { public static void main(String[] args) { Square block = new Square(); Square box = new Square(3); block.setWidth(4); System.out.println(box.getWidth()); // 3 System.out.println(block.computeArea()); // 16 System.out.println(box.computePerimeter()); // 12 } } // Square class class Square { // ********************************* constructors // default constructor public Square() { myWidth = 0; } // "other" constructor public Square(double width) { myWidth = width; } // ********************************* accessor method public double getWidth() { return myWidth; } // ********************************* modifier methods public void setWidth(double width) { myWidth = width; } // ********************************* "interesting" methods public double computeArea() { return myWidth * myWidth; } public double computePerimeter() { return myWidth * 4; } // ********************************* instance variables (properties) private double myWidth; }