Question: Write a CenteredSquaresPrinter program that constructs a Rectangle object square representing a square with top-left corner (100, 100) and side length 200, prints its location
Write a CenteredSquaresPrinter program that constructs a Rectangle object square representing a square with top-left corner (100, 100)
and side length 200, prints its location by calling System.out.
println(square), applies the grow and translate methods, and calls System.out.println(square) again. The calls to grow and translate should modify the square so that it has half the width and is centered in the original square. If the squares were drawn, they would look like the figure at right. 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.

Step by Step Solution
3.51 Rating (161 Votes )
There are 3 Steps involved in it
This question requires you to write a program that manipulates a Rectangle object to first print out its location then change its size and position an... View full answer
Get step-by-step solutions from verified subject matter experts
