Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create an object to implement a circle class which allows the programming to store a circle object. The object should use the point class developed

Create an object to implement a circle class which allows the programming to store a circle object. The object should use the point class developed previously. You will be given the center point and one point on a circle. The object should have at least two constructors, appropriate set/get functions, and overloaded I/O functions. It should include functions the return the proper value for the following:

Determines the radius

Determines the diameter

Calculates the area of a circle

Calculates the circumference of a circle

Does your circle intersect another given circle

Does your circle lie within another given circle

Using C++ and the given code

#include  using namespace std; // We have setup class framework for you. Please copy the point // class you created to this file. class Circle { public: private: }; int main() { Circle C1; // cout << "Enter C1: "; // cin >> C1; // cout << "C1: "; // cout << C1; // cout << endl; return 0; }

Point Code

#include

using namespace std;

// We have setup class framework for you.

// Please add cin/cout overload first and at the same time add the coordinates

//

// See github example as specified in the assignment handout for exaamples

//

class Point {

public:

Point() {

x = 0;

y = 0;

}

Point(int a,int b) {

x = a;

y = b;

}

friend istream& operator>>(istream &input, Point &p ) {

// Finish me second by adding proper input >> statement

input >> p.x >> p.y;

return input;

}

friend ostream& operator<<(ostream &output, const Point &p ) {

// Finish me thrid by adding proper output << statement

output << "X coordinate is: " << p.x << " and Y coordinate is: " << p.y;

return output;

}

// Please add constructors and other functions here.

private:

// Add me first

int x;

int y;

};

int main() {

Point P1;

cout << "Enter P1: ";

cin >> P1;

cout << "P1: ";

cout << P1;

cout << endl;

return 0;

}

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

Essential SQLAlchemy Mapping Python To Databases

Authors: Myers, Jason Myers

2nd Edition

1491916567, 9781491916568

More Books

Students also viewed these Databases questions