10.9k views
0 votes
Write a program called FourRectanglePrinter that constructs a Rectangle object, prints its location by calling System.out.println(box), and then translates and prints it three more times, so that, if the rectangles were drawn, they would form one large rectangle:

User Shoji
by
7.1k points

1 Answer

3 votes
C:\java>javac FourRectanglePrinter.java
FourRectanglePrinter.java:11: incompatible types
found : void
required: java.awt.Rectangle
Rectangle box1 = box.translate(0,30);
- ^
FourRectanglePrinter.java:14: incompatible types
found : void
required: java.awt.Rectangle
Rectangle box2 = box.translate(40,0);
- ^
FourRectanglePrinter.java:17: incompatible types
found : void
required: java.awt.Rectangle
Rectangle box3 = box.translate(40,30);
User Eczn
by
6.9k points