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
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 .