Hello.I am currently a newbie in Java and I was wondering if smn would help me for this project.



Build a class named Rectangle that represents a two - dimensional area . This class

must contain:

public Rectangle ( int x , int y , int width, int length)

-Constructs a rectangle that has the height of the upper - left coordinates x , y , and size as width and length:

public Rectangle ( Point p , int width , int length)

-Builds a rectangle that has the height of the upper - left point p and with sizes as width and length.

( Point is a class that you have to build that contains two fields that define the position of a point in the coordinate plan ) .

public int getWidth ( )

public int getGjat ( )

public int getX ( )

public int getY ( )

public boolean contains ( int x , int y )

-Returns true if the point with coordinates x , y is located within the rectangle .

public boolean contains ( Point p )

Returns true if the point p is inside the rectangle .

public Rectangle cross ( Rectangle r )

-Returns a new rectangle that represents the largest surface that is contained to this rectangle and to the other rectangle r . If rectangulars does not cross at all, should be returned a rectangle with width and length equal to 0 :

public String toString ( )

-Returns a string representation of the rectangle ,shaped in the form (for example):

" Rectangle [ x = 1 , y = 2 ,width = 3 , length = 6 ] " .

-Build an application that tests the Rectangle class .

2 Years
Discussion Span
Last Post by CoderGuy101

While I can understand that this appears to be a lot to do, if you follow each of your assignment requirements, point by point, you will have it finished in no time. As it is, this forum and its members do not promote doing a student's homework for them. It kind of defeats the purpose of you learning don't you think?

So some work, if it is wrong, we can help but you will not get the work done for you. :)


Here's a way to output the rectangle....

You could write a method that outputs the arrays using a loop.

Votes + Comments
Nonsense advice - there are no arrays
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.