previous | start | next

Answers

  1. public int getWidth()
    {
    return width;
    }
  2. There is more than one correct answer. One possible implementation is as follows:
    public void translate(int dx, int dy)
    {
    int newx = x + dx;
    x = newx;
    int newy = y + dy;
    y = newy;
    }


previous | start | next