Ans Doc417


(Enhancing Class Rectangle ) Create a more sophisticated Rectangle class than the one you created in Exercise 9.11. 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.

professor instructions;

Do exercise 9.12 on page 429 for 100 points.
This exercise makes a reference to Exercise 9.11. Here is the code for Exercise 9.11:
DO NOT click drag the code into your new project. The code MUST be copied and pasted into new .h/.cpp files which you create. If you drag copy code into your project and then send it to me it probably will not contain that code!! This means you WILL have a rectangle class (Rectangle.h and Rectangle.cpp) and a file called Ex09_11.cpp that has your main function.
Before submitting your project check your archive and be sure it contains your .h and .cpp files.
I will be looking for the following in your program.
*Your program MUST use Cartesian coordinates (x and y coordinates for a total of eight coordinates per figure, each corner of your rectangle is an x,y coordinate). This is a major modification of the supplied code.
*You must follow my previous instructions regarding how to start your program. What you are doing is editing the supplied code so instead of the class Rectangle using width and length it will use cartesian coordinates as defined above.
*Do not have the user enter the coordinates. Hard code them into your program.
*You must include a default constructor for the rectangle class. The default constructor should have the following coordinates ( point 1:(0,0), point 2:(0,1), point 3:(1,1), point 4:(1,0). Be sure the constructor has the set function as described in the textbook assignment. I recommend you pass these points as eight integers (0,0,0,1,1,1,1,0).
*Your program must instantiate four objects of the Rectangle class.
• Your first object should form a rectangle but not a square using your supplied coordinates.
• Your second object should form a square using your supplied coordinates.
• Your third object should should not be instantiated with any points allowing your default constructor points to be used
Hint: Remember that your constructor header can contain default values. If you create an object without passing values those default values will be used. See example program in chapter.
• Your fourth object should not form a rectangle or a square and the default coordinates should replace your original coordinates.
Hint: Compare two sides to determine if they are unequal in length.
The textbook assignment asks for a set function that tests if any coordinates are over 20. You do not have to write that function.

Do include a function that gets called to check if your coordinates form a square or rectangle as mentioned in the textbook assignment.
Keep your code simple. To decide if the rectangle is a square compare its height verses width.
You choose which points and values to compare. If length = width is a square.
This is a programming project intended to show that you know how to program functions and understand constructors.
Review my supplied image of the program’s output as a guide.
If you submit the code that I am supplying you will receive zero points.
*AGAIN, do not have the user make the coordinate entries. Code it into the program.
Deadline: As posted
IMPORTANT: Any submitted exercise or project that fails to compile and run shall receive zero points.
*You must have a rectangle class (Rectangle.h and .Rectangle.cpp files) that stores those cartesian coordinates and tests those coordinates for rectangle, square or neither in your program. You do not have to test if the rectangle is skewed. Just if it is square or not square.

this is how it should output;