Create a class Rectangle. The class has attributes length and width, each of which defaults to 1. It has methods that calculate the perimeter and the area of the rectangle. It has set and get methods for both length and width. The set methods should verify that length and width are each floating-point numbers larger than 0.0 and less than 20.0. Write a program to test class Rectangle.
Create a more sophisticated Rectangle class than the one you created above. This class stores only the Cartesian coordinates of the four corners of the rectangle. The constructor calls a set method that accepts four sets of coordinates and verifies that each of these is in the first quadrant with no single x- or y-coordinate larger than 20.0. The set method also verifies that the supplied coordinates specify a rectangle.
Provide methods to calculate the length, width, perimeter and area (the length is the larger of the two dimensions). Include a predicate method (methods like this, that test a quality and return true/false, are called predicate methods) isSquare which determines whether the rectangle is a square. Write a program to test class Rectangle.