Enhancing class rectangle create a more sophisticated


Question: (Enhancing Class Rectangle) Create a more sophisticated Rectangle class than the one you created in Exercise. This class stores only the Cartesian coordinates of the four corners of the rectangle. 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-coordinate larger than 20.0. The set function also verifies that the supplied coordinates do, in fact, specify a rectangle. Provide member functions that calculate 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.

Exercise: (Rectangle Class) Create a class Rectangle with attributes length and width, each of which defaults to 1. Provide member functions that calculate the perimeter and the area of the rectangle. Also, provide set and get functions for the length and width attributes. The set functions should verify that length and width are each floating-point numbers larger than 0.0 and less than 20.0.

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Enhancing class rectangle create a more sophisticated
Reference No:- TGS02405672

Now Priced at $10 (50% Discount)

Recommended (90%)

Rated (4.3/5)