Create a class rectangle to store each cartesian coordinate (x, y) of the four corners of the
Question:
Create a class rectangle to store each cartesian coordinate (x, y) of the four corners of the rectangle. each corner should be of type Point. the constructor calls a set function that accepts four sets of coordinates and verifies that each of these is in the first quadrant with no single x or y coordinates larger than 20.0
the set function also verifies that the supplied coordinates do specify a rectangle. the function should generate an error message if the four supplied coordinates specify a shape other than a rectangle.
provide member function that calculates the length, width, perimeter, and area. the length is the larger of the two dimensions. include a predicate function square that determines whether the rectangle is a square.
inputs: four coordinate values (x, y)
input validation: make sure the coordinate values are within the range of 0 and 20. let the user correct the mistake.
make sure the coordinates represent a rectangle. otherwise, display an error message that these are not rectangle coordinates and exit the program.
Outputs: display length, width, perimeter, and area.
Probability And Statistics
ISBN: 9780321500465
4th Edition
Authors: Morris H. DeGroot, Mark J. Schervish