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

Thanks.

JAVA PROGRAMM

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 .

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.

commented: Nonsense advice - there are no arrays -3
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.