Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The following the declaration for Point class and Circle class: class Point { fr

ID: 3648436 • Letter: T

Question

The following the declaration for Point class and Circle class:

class Point {
friend ostream &operator<<( ostream &, const Point & );
public:
Point( int a = 0, int b = 0 ); // default constructor
void setPoint( int a, int b ); // set coordinates
int getX() const { return x; } // get x coordinate
int getY() const { return y; } // get y coordinate
protected: // accessible by derived classes
int x, y; // x and y coordinates of the Point
};

class Circle {
friend ostream &operator<<( ostream &, const Circle & );
public:
// default constructor
Circle( double r = 0.0, int a = 0, int b = 0 );

void setRadius( double ); // set radius
double getRadius() const; // return radius
double area() const; // calculate area
protected:
double radius;
};

Please rewrite the above code for Circle to make Circle inherits from Point publicly. Write a main function to test your program. The main function will do the following:
1. Declare a point with coordinates (30,50)
2. Declare a circle centered at (120,89) with radius 2.7
3. Print the point and the circle
4. Change the coordinate of the point to (1,2)
5. Print the point
6. Change the center of the circle to (10,20)
7. Print the circle
8. Print only the new center of the circle (do not print the radius)

Compile and run the program, your output should be like below
Point p: [30, 50]
Circle c: Center = [120, 89]; Radius = 2.70
Point p: [1, 2]
Circle c: Center = [10, 20]; Radius = 2.70
Center of Circle c: [10, 20]

Explanation / Answer

//put extends keyword between class names. it inherits the Point properties //it act like as IS-A relation class Circle extends Point { friend ostream &operator
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote