0

```
#include<iostream>
#include<iomanip>
using namespace std;
class circleType
{
public:
void setRadius(double cRadius);
double getRadius() ;
double calcArea() ;
double calcCir() ;
void print() ;
circleType ();
circleType(double cRradius);
private:
double radius;
};
void circleType::setRadius(double cRadius)
{
radius = cRadius;
}
void circleType::print()
{
cout << "The radius of the circle is: " << getRadius() << endl;
cout << "The area of the circle is: " << calcArea() << endl;
cout << "The circumference of the circle is: " << calcCir() << endl <<endl;
}
double circleType::getRadius()
{
return radius ;
}
double circleType::calcArea()
{
double pi = 3.14159;
return (pi * (radius * radius));
}
double circleType::calcCir()
{
double pi = 3.14159;
return (2 * pi * radius);
}
circleType::circleType() //Default rutor
{
radius;
}
circleType::circleType(double cRadius)
{
radius = cRadius;
}
class cylinderType: public circleType
{
public:
void setHeight(double cHeight);
void print() ;
double getHeight() ;
double calcVolume();
double calcSurface() ;
cylinderType();
cylinderType(double cHeight);
private:
double height;
};
void cylinderType::setHeight(double cHeight)
{
height = cHeight;
}
void cylinderType::print()
{
cout << "The height of the cylinder is: " << getHeight() << endl;
cout << "The radius of the cylinder base is: " << getRadius() << endl;
cout << "The volume of the cylinder is: " << calcVolume() << endl;
cout << "The surface area of the cylinder is: " << calcSurface() << endl;
}
double cylinderType::getHeight()
{
return height;
}
double cylinderType::calcVolume()
{
double pi = 3.14159;
return (height * pi) * (getRadius() * getRadius());
}
double cylinderType::calcSurface()
{
double pi = 3.14159;
return (2 * calcArea()) + (calcCir() * height);
}
cylinderType::cylinderType()
{
height ;
}
cylinderType::cylinderType(double cHeight)
{
height = cHeight;
}
int main()
{
circleType circle;
double r ;
cout << "Enter the radius of the circle: ";
cin >> r;
circle.setRadius(r);
circle.print();
cylinderType cylinder;
double h;
cout << "Enter the height of the cylinder: ";
cin >> h;
cylinder.setHeight(h);
cylinder.print();
system("pause");
return 0;
}
```