Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Principles Programming And Performance

Authors: Patrick O'Neil, Elizabeth O'Neil

2nd Edition

1558605800, 978-1558605800

More Books

Students also viewed these Databases questions

Question

Why is executive onboarding for external hires so difficult?

Answered: 1 week ago

Question

Describe the Indian constitution and political system.

Answered: 1 week ago

Question

Explain in detail the developing and developed economy of India

Answered: 1 week ago

Question

Problem: Evaluate the integral: I = X 52+7 - 1)(x+2) dx

Answered: 1 week ago

Question

What is gravity?

Answered: 1 week ago

Question

What is the Big Bang Theory?

Answered: 1 week ago

Question

1. How will you, as city manager, handle these requests?

Answered: 1 week ago

Question

1. Identify the sources for this conflict.

Answered: 1 week ago

Question

3. How would you address the problems that make up the situation?

Answered: 1 week ago