a. a point in the x-y plane is represented by its x-coordinate and y-coordinate. Design a class, pointType, that can store and process a point in the x-y plane.
b. Every circle has a center and a radius. Given the radius we determine the circles area and circumference. Given the center we can determine its position in the x-y plane. The center of a circle is a point in the x-y plane. Design a class, circleType, that can store the radius and center of the circle. Because the center is a point in the x-y plane, and you designed the class to capture the properties of a point in Programming exercise a, you must derive the class circleType from the class pointType. You should be able to perform the usual operations on the circle, such as setting the radius, printing the radius, calulating and printing the area and circumference, and carrying out the usual operations on the center. Also write a program to test various operations on a circle.
Any help is appreciated
#include <iostream>
using namespace std;
class pointType
{
public:
pointType(double x = 0, double y = 0)
{
xCoordinate = x;
yCoordinate = y;
}
double getX() {return xCoordinate;}
double getY() {return yCoordinate;}
protected:
double xCoordinate, yCoordinate;
};
class circleType: public pointType
{
double rad;
public:
circleType(double r, double x, double y): pointType(x, y)
{
rad = r;
}
void print();
};
int main()
{
circleType cir(1, 2, 3);
double x, y, z;
char a, b, c;
cout<< "Enter circle radius: " <<endl;
cin >> x;
cout<<"Enter center point coordinates: " <<endl;
cin>> a >> y >> b >> z >> c;
cout << "Circle 1: ";
cir.print();
//cout << endl;
//circleType c(1, 2, 3);
//cout << "Circle: " << endl;
//cin >> 1 >> 2 >> 3;
//cout << endl;
return 0;
}