title: (Java) Stuck on a method
body: <p>I am having trouble figuring out how to do this. What I am trying to do is receive an X and a Y both are int and add those to the X and Y of both endpoints. For example, if one endpoint is (1,2) and other is (5,6) and the number that is received is (3,3). Then the final endpoints must be (4,5) and (8,9). Here is my code so far...</p>
  
  <pre><code>public class Segment
  {
  private Point Point1;
  private Point Point2;
  
  public Segment ( )
  {
      this.Point1 = new Point(0, 0);
      this.Point2 = new Point(7, 7);
  }
  
  public Segment (int x1, int y1, int x2, int y2)
  {
      if (x1 == x2 &amp;&amp; y1 == y2)
          throw new IllegalArgumentException ("Error, this would cause the segment to be 0. Please re-enter two different value.");
      else
          {
              Point1 = new Point (x1,y1);
              Point2 = new Point (x2,y2);
          }
  }
  
  public Segment (Point p1, Point p2)
  {
      if (p1 == p2)
          throw new IllegalArgumentException ("Error, this would cause the segment to be 0. Please re-enter two different value.");
      else
          {
              Point1 = new Point (p1);
              Point2 = new Point (p2);
          }
  }
  
  public Segment (Segment other)
  {
      Point1 = new Point (other.Point1);
      Point2 = new Point (other.Point2);
  }
  public String toString ( )
  {
      return (Point1) + "---------" + (Point2);
  }
  
  //More codes
  
  public void translate (int xmove, int ymove) // &lt;--- Need help here.
  {
      this.Point1 = ((x1 + xmove), (y1 + ymove));
      this.Point2 = this.Point2 + ymove;
  }
  </code></pre>
  
  <p>I cannot figure out how to add it to the points. Please help thank you.</p>