Write a GrowSquarePrinter program that constructs a Rectangle object square representing a square with top-left corner (100, 100) and side length 50, prints its location by calling System.out.println(square), applies the translate and grow methods and calls System.out.println(square) again. The calls to translate and grow should modify the square so that it has twice the size and the same top-left corner as the original. If the squares were drawn, they would look like this:


Your program will not produce a drawing. It will simply print the locations of square before and after calling the mutator methods.

Look up the description of the grow method in the API documentation.

Complete the following file:


import java.awt.Rectangle; /** Prints a rectangle, then translates it, and grows it so that the new square is twice the size of the original and has the same top-left corner. */ public class GrowSquarePrinter { public static void main(String[] args) { /* Rectangles are created with x, y, width, height where x and y are the upper left corner of the object. We want the center of the square at 100, 100 and the sides to be 50. The upper left corner coordinate will be at 75, 75 for the center to be at 100, 100. */ ... /* Check the Java API to see how the grow method works. */ ... /* Use translate to reposition the top-left corner back to 75, 75. */ ... } }