Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Using C++
need answered within 2 hours please image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Using C++ image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
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 #include "Rectangle.h" #include "Point.h" using namespace std; int main(int argc, const char * argv[]) { Point al{3,6}; Point b1{7,6); Point c1{7,3}; Point d1{3,3}; Point a2{5,5); Point b2{9,4}; Point c248,0}; Point d2(4,1); Rectangle rec1{a1, b1, ci,d1}; Rectangle rec2(a2,b2, c2, d2}; cout

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_2

Step: 3

blur-text-image_3

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

Nested Relations And Complex Objects In Databases Lncs 361

Authors: Serge Abiteboul ,Patrick C. Fischer ,Hans-Jorg Schek

1st Edition

3540511717, 978-3540511717

More Books

Students also viewed these Databases questions

Question

1. What are the pros and cons of five sources of job candidates?

Answered: 1 week ago

Question

Consider this article:...

Answered: 1 week ago

Question

5. If yes, then why?

Answered: 1 week ago

Question

6. How would you design your ideal position?

Answered: 1 week ago