@@ -0,0 +1,1746 @@
+package fig;%0A%0Aimport java.awt.Point;%0Aimport java.awt.geom.Point2D;%0Aimport java.io.PrintWriter;%0A%0Apublic class Rectangle extends Figure %7B%0A%0A%09public Rectangle() %7B%0A%09%09super(%22Rectangle%22, new Point(0, 0));%0A%09%09width = 0;%0A%09%09height = 0;%0A%09%7D%0A%0A%09public Rectangle(int w, int h, Point p) %7B%0A%09%09super(%22Rectangle%22, p);%0A%09%09width = w;%0A%09%09height = h;%0A%09%7D%0A%0A%09public void draw(ScreenManager sm) %7B%0A%09%09int lx = (int) getCenterPoint().getX() - width / 2;%0A%09%09int ly = (int) getCenterPoint().getY() - height / 2;%0A%09%09for (int i = 0; i %3C width; i++) %7B%0A%09%09%09sm.draw(lx + i, ly);%0A%09%09%09sm.draw(lx + i, ly + height - 1);%0A%0A%09%09%7D%0A%09%09for (int i = 1; i %3C height - 1; i++) %7B%0A%09%09%09sm.draw(lx, ly + i);%0A%09%09%09sm.draw(lx + width - 1, ly + i);%0A%09%09%7D%0A%09%09// sm.draw((int)centerPoint.getX(),(int)centerPoint.getY());%0A%09%7D%0A%0A%09public void erase(ScreenManager sm) %7B%0A%09%09int lx = (int) getCenterPoint().getX() - width / 2;%0A%09%09int ly = (int) getCenterPoint().getY() - height / 2;%0A%09%09for (int i = 0; i %3C width; i++) %7B%0A%09%09%09sm.erase(lx + i, ly);%0A%09%09%09sm.erase(lx + i, ly + height - 1);%0A%0A%09%09%7D%0A%09%09for (int i = 1; i %3C height - 1; i++) %7B%0A%09%09%09sm.erase(lx, ly + i);%0A%09%09%09sm.erase(lx + width - 1, ly + i);%0A%09%09%7D%0A%09%09// sm.erase((int)centerPoint.getX(),(int)centerPoint.getY());%0A%09%7D%0A%0A%09public void center(ScreenManager sm) %7B%0A%09%09erase(sm);%0A%09%09centerPoint = new Point(25, 20);%0A%09%09draw(sm);%0A%09%7D%0A%0A%09public void showDetail(PrintWriter pw) %7B%0A%09%09pw.printf(%22%25s: Width: %25s,Height: %25s,Center: (%25s,%25s)%5Cn%22, getName(),%0A%09%09%09%09getWidth(), getHeight(), getCenterPoint().getX(),%0A%09%09%09%09getCenterPoint().getY());%0A%09%7D%0A%0A%09public int getHeight() %7B%0A%09%09return height;%0A%09%7D%0A%0A%09public int getWidth() %7B%0A%09%09return width;%0A%09%7D%0A%0A%09public Point2D getCenterPoint() %7B%0A%09%09return centerPoint;%0A%09%7D%0A%0A%09protected int height;%0A%0A%09protected int width;%0A%0A%09/**%0A%09 * %0A%09 */%0A%09private static final long serialVersionUID = 1L;%0A%7D%0A

Create Rectangle.java