Question: Use three classes, Point. Circle, and Cylinder. Use inheritance property in derived classes; Circle and Cylinder. Use both constructors and setdata() functions to assign data

Use three classes, Point. Circle, and Cylinder. Use inheritance property in derived classes; Circle and Cylinder. Use both constructors and setdata() functions to assign data to objects. The Cylinder class should calculate volume and area of Cylinder by inheriting Area from circle class.

This program is written in c++. Please help me complete program. I can't figure out the issues. I need to use printdata() as well to print the radius, height, area, and volume in the main program.

#include using namespace std;

class point{

private: int x; int y;

public:

point(int _x, int _y){ x=_x; y=_y; } point() {} void setdata(int _x,int _y){ cin>>x; cin>>y; } };

class circle:public point {

private: int radius;

public:

circle(int _radius, int _x, int _y):point(_x, _y){ radius=_radius;

} void setdata(int _radius, int _x, int _y){ _radius=_x; } void printdata(int _radius, int _x, int _y){ cout<<"Radius ="<<" "<<_x<

class cylinder: public circle{

private: int height;

public:

cylinder(int _height, int _radius, int _x, int _y):circle(_radius,_x,_y){ height=_height; } void setdata(int _height, int _radius, int _x, int _y){

_height=_y; } void printdata(int _height, int _radius, int _x, int _y){ cout<<"Area ="<<(2*3.14*_x*_y)+(2*3.14*_x*_x)<

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!