Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8261333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:22:12+00:00 2026-06-08T03:22:12+00:00

so in my online class I have to do something related to rectangles. I

  • 0

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.

Here is the link of the project just incase you don’t understand what I’m going to ask:
http://pages.eimacs.com/eimacsstatics/download/apjava/project1bj.pdf

The part I’m confused about is adding a definition for printAPRectangle, because I don’t think I’m doing it correctly.

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.

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),

Here is my APRectangle class 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;
    }
}

Here is my APPoint class:

public class APPoint {
private double myX;
private double myY;

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;  } }

and finally here is my Main Class:

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!" );
  }

}

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?

Thanks,
Rohan

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T03:22:14+00:00Added an answer on June 8, 2026 at 3:22 am

    In order to use APRectangle’s methods, you must call them from an APRectangle object.
    The printAPRectangle method receives an APRectangle object called R.
    You must use R and call it’s member functions.
    You need to use these:

    • R.getTopLeft()
    • R.getWidth()
    • R.getHeight()

      public static String printAPRectangle( APRectangle R)
      {
      return “[APRectangle ” + printAPPoint(R.getTopLeft) +
      ” ” + R.getWidth() + “,” + R.getHeight() + “]” ;
      }

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to have an abstract class Server with an abstract method called Initialize
I have some methods for a class which return arrays like [1, 3, 2,
We have some client code which is using the SqlConnection class in .NET to
In the main class of my project, I have public class MyClass extends Activity{
I have seen Java code that says something like: SomeClass.this.someMethod(someArg); Blah(AnotherClass.class); Blah(YAClass.this); What do
I have a class which inherits from BindingList to apply sorting to a bindinglist.
From examples that I have seen online and in a Programming Entity Framework CodeFirst
I have a some model.py like so: class Muestraonline(models.Model): accessionnumber = models.ForeignKey(Muestra, related_name='online_accessionnumber') muestraid
Various online services have different values for maximum year of expiry, when it comes
Searching online, I have found the following routine for calculating the sign of a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.