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.

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.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!