Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in C++ In C++ A. Design a class named Circle2D that contains: 1) Two double data fields named x and y that specify the center

in C++image text in transcribedimage text in transcribedIn C++

A. Design a class named Circle2D that contains: 1) Two double data fields named x and y that specify the center of the circle with constant get functions. 2) A double data field radius with a constant get function. 3) A static int data field numberOfCircles with a static get function. 4) A no-arg constructor that creates a default circle with (0,0) for (x,y) and 1 for radius. (Do not forget to update numberOfCircles). 5) A constructor that creates a circle with the specified x, y, and radius. (Do not forget to update numberOfCircles). 6) A copy constructor Circle2D(const Circle2D & circle) that creates a circle with a given Circle2D object. (Do not forget to update numberOfCircles). 7) A Destructor that updates numberOfCircles. 8) A constant function getArea() that returns the area of the circle. 9) A constant function getPerimeter() that returns the perimeter of the circle. 10) A constant function contains(double x, double y) that returns true if the specified point (x, y) is inside this circle. See Figure la. 11) A constant function contains(const Circle2D& circle) that returns true if the specified circle is inside this circle. See Figure 1b. 12) A constant function overlaps(const Circle2D& circle) that returns true if the specified circle overlaps with this circle. See Figure 1c. Note: The distance from one point to another point is V(x x2)2 + (1 - y2)2 Write a test program (testCircle2D.cpp) that tests all functions in the class: 1) Create a Circle2D object (cirl) with no-arg constructor. 2) Call getArea() and getPerimeter() from cir1 object. 3) Call contains(double x, double y) function from the cir1 object with the specified point (x, y). 4) Create a Circle2D object (cir2) with the specified x, y, and radius. 5) Create a Circle2D object (cir3) with the copy constructor with the cir2 as an argument. 6) Call contains(const Circle2D& circle) function from cir2 with the cir3 as an argument. 7) Create a Circle2D object (pCiri) on the heap using a pointer to hold its address. 8) Call overlaps(const Circle2D& circle) function from pCir1 pointer with the cir3 as an argument. 9) Call getArea() and getPerimeter() functions from pCiri. 10) Call the deconstructor of pCir1 to remove the object from the heap. 11) Call getNumberOfCircles() function from the cir3

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

Expert Oracle Database Architecture

Authors: Thomas Kyte, Darl Kuhn

3rd Edition

1430262990, 9781430262992

More Books

Students also viewed these Databases questions