public class Rectangle { // fields private int width; private int height; private Point origin; // constructors public Rectangle(int initWidth, int initHeight, Point initOrigin) { width = initWidth; height = initHeight; origin = initOrigin; } public Rectangle(int initWidth, int initHeight, int originX, int originY) { width = initWidth; height = initHeight; origin = new Point(originX,originY); } // methods public void setWidth(int newWidth ) { width = newWidth; } public int getWidth() { return width; } public void setHeight(int newHeight ) { height = newHeight; } public int getHeight() { return height; } public void setOrigin(Point newOrigin) { origin = newOrigin; } public Point getOrigin() { return origin; } public int getArea() { return width * height; } // Move rectangle origin by dx,dy public void moveOrigin(int dx, int dy) { origin.setX( origin.getX() + dx ); origin.setY( origin.getY() + dy ); } }