THis is my question and I have no idea how to do it.

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 the figure at right.

Recommended Answers

constructs a Rectangle object

Read the API documentation for the Rectangle class - especially its constructors

calls to translate and grow should ...

these two methods are also documented in the API documentation

Jump to Post

All 3 Replies

You printed the same variable twice. You would either have to change it, or make a different one.

commented: This seems to be an answer to a completely different question! -3

If the squares were drawn, they would look like the figure at right.

What figure at right?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.