Coding something about a rectangle (Java)
<p>so in my online class I have to do something related to rectangles. I have some confusion on how to edit my main class to make it use a method from another class. </p>

<p>Here is the link of the project just incase you don't understand what I'm going to ask:
 <a href="http://pages.eimacs.com/eimacsstatics/download/apjava/project1bj.pdf" rel="nofollow">http://pages.eimacs.com/eimacsstatics/download/apjava/project1bj.pdf</a></p>

<p>The part I'm confused about is adding a definition for printAPRectangle, because I don't think I'm doing it correctly.</p>

<blockquote>
  <p>Add accessor instance methods for the three instance variables, and then
  click the Compile button on the APRectangle class editor window to compile
  your code and check for errors.</p>
  
  <p>Reopen the definition of MainClass and insert a definition of the static
  method printAPRectangle after the definition of printAPPoint. This method
  should be defined in such a way that, if it is applied to the APRectangle
  object whose top left corner is the APPoint object with coordinate (-5.0,3.6),</p>
</blockquote>

<p>Here is my APRectangle class code:</p>

<pre><code>    public class APRectangle
   {
    private APPoint myTopLeft;
    private double  myWidth;
    private double  myHeight;

    public APRectangle( APPoint topLeft, double width, double height )
    {
        myTopLeft = topLeft;
        myWidth = width;
        myHeight = height;
    }

    public APPoint getTopLeft()
    {
        return myTopLeft;
    }

    public double getWidth()
    {
        return myWidth;
    }

    public double getHeight()
    {
        return myHeight;
    }
}
</code></pre>

<p>Here is my APPoint class:</p>

<blockquote>
  <p>public class APPoint {
      private double myX;
      private double myY;</p>

<pre><code>public APPoint( double x, double y )  {
 myX = x;
 myY = y;  }
public double getX()   {
return myX;  }
public void setX( double x )  {
 myX = x;  }
public double getY()  {
 return myY;  }
public void setY( double y )  {
 myY = y;  } }
</code></pre>
</blockquote>

<p>and finally here is my Main Class:</p>

<pre><code>public class MainClass
{
 public MainClass()
 {
    }

 public static String printAPPoint( APPoint p )
 {
     return "(" + p.getX() + "," + p.getY() + ")";
    }

 public static String printAPRectangle( APRectangle R)
 {
     return "[APRectangle " + printAPPoint( +
            " " + getWidth() + "," + getHeight() + "]" ;
 }

 public static void main(String[] args)
 {
     APPoint p = new APPoint( 1.0, 2.0 );
     APRectangle R = new APRectangle( q, 7.5, 3.6);
     System.out.println( "p is " + printAPPoint( p ) );
     System.out.println( "Done!" );
  }

}
</code></pre>

<p>I don't know how to do the part that asks me how to edit the main class, and also the part where I have to output myTopLeft because it's an APPoint and not a normal string. It says I have to use printAPPoint but how do i use it?</p>

<p>Thanks,
Rohan</p>
