The Rexy
class is used to created rectangular shapes on screen composed of []
blocks. The Rexy
constructor takes two integer parameters for its constructor–the width
and the height
–and has two methods that allow the a text-based box made up of “[]” to be displayed on the screen: a printIt()
method that displays the box in the Terminal window, and a toString()
method that returns a String
that can be printed by a caller.
Then write a RexyRunner
that demonstrates the class’s features.
Sample interaction:
Enter rectangle width: 4
Enther rectangle height: 2
Here's the Rexy displayed by the printIt() method:
[][][][]
[][][][]
Here's the Rexy object being printed via its toString() method:
[][][][]
[][][][]