Question: Using C++ need answered within 2 hours please Using C++ Rectangle in a Coordinate System The following figure represents rectangles in an x, y coordinate










Rectangle in a Coordinate System The following figure represents rectangles in an x, y coordinate systems. Each rectangle has four points. Each point is represented with their x and y coordinates For example, point A is the top left most comer of one of the rectangles below and it has x and y values 3 and 6 respectively. You will implement Point.cpp and Rectangle.cpp given their header files Point.h and Rectangle.h Point. Difndef Point #define Point_n class Point friend std::ostream& operator cistd::ostream &, Point 6); public: explicit Point (double 8.0, double 8.a); -Point(); Point & setx{double); Point & setY(double); double getX() const; double getY() const; private: double x; double y: }; #endif / Point_ */ Step 1. Implement Point.cpp (30 points) 1. Constructor and destructor. The constructor should set x and y data members by calling their setters in a cascading function call style and display a message saying the constructor of Point object is being called. The destructor should also display a similar message indicating the destructor for a Point object is being called. b. Setters and getters: Implement the setters and getters for x and y data members. The setters must allow cascading function calls. c. Overloading d. calculate Area(): This function returns the area of the rectangle. To calculate area, you must first calculate the length of sides of the rectangle. e. calculate Perimeter(): This function returns the perimeter of the rectangle. To be able to calculate that you must again calculate sides of the rectangle. Step 3. Test your classes with the following main.cpp #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
