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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started