Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Probability And Statistics

Authors: Morris H. DeGroot, Mark J. Schervish

4th Edition

9579701075, 321500466, 978-0176861117, 176861114, 978-0134995472, 978-0321500465

More Books

Students also viewed these Databases questions

Question

How does mindfulness practice assist in rational decision-making?

Answered: 1 week ago