Write a program that creates a circle class and uses it to


Please help code the highlighted lab I am very confused on it, reminder im using c++

Write a program that creates a Circle class and uses it to find out how far apart the centers of Circle objects are. Recall that at the very least CIrcle Objects will need to have radius, center_x, and center_y as data members.

The class should have a default constructor to set radius = 1 and to place the center at (0,0).

It hsould also have a constructor to allow three values to be initialized with user-supplied data when a Circle object is created. It should laso have functions to set and to get each of the data members.

Include an overloaded subtraction operator that return how far apart two Circle object centers are.

It must not return any negative numbers. Ex circle1 = (3,2) circle2 = (4,4) when subtracted should return 2.236 not -2.236.

Have the program create a pair of Circle objects and then output where their centers are and how far apart they are. Display the result to 3 decimal points.

Sample Output

circle1 center: (3,2)

circle2 center: (4,4)

The two circles are 2.236 units apart.

Here is the coding I have started so far.

#include

#include

using namespace std;

class Circles

{

private:

double radius;

double center_x, center_y;

double amount;

public:

Circles Circles::SetValue()

{

radius = 1;

center_x = 0;

center_y = 0;

amount = 0;

}

Circles Circles::GetValue(double r, double x, double y) // Constructor

{

radius = r;

center_x = x;

center_y = y;

}

Circles Circles::FindValue(double radius, double center_x, double center_y)

{

}

void printCircles() const

{

cout << "clircle1 ceneter ( " << center_x << ", " << center_y << " )" << endl;

cout << "clircle2 ceneter ( " << center_x << ", " << center_y << " )" << endl;

cout << " The two circles are " << amount << " units apart." << endl;

}

};

 

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Write a program that creates a circle class and uses it to
Reference No:- TGS02889309

Expected delivery within 24 Hours