Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in c++ start with this and modify to this 1) Circle Family (Inheritance) Define a Circle class with a private double variable radius. It should

in c++
start with this image text in transcribed
and modify to this
image text in transcribed
1) Circle Family (Inheritance) Define a Circle class with a private double variable radius. It should have a default constructor that sets the radius to zero and an overloaded constructor that sets it to a provided value. You should have the following methods: setRadius, getRadius, getDiameter, getCircumference, and getSurfaceArea. Define a child class, Cylinder, with a private double variable height, has a default constructor that sets height and radius to zero and an overloaded constructor that sets height and radius to provided values. Cylinder should have the additional methods getHeight, setHeight, getVolume and override getSurfaceArea. Define a second child class, Sphere. It should override getSurfaceArea and define getVolume. Surface of circle is Plr^2. Surface of a cylinder is 2*Pr*r*h+2*Pl*r 2. Surface of a sphere is 4*PI*r^2. Volume of a cylinder is Pl*r*2"h. Volume of a sphere is 4/3*Pl*r*3. programs, pomis normallure W TOHOW course coum Burdemes. 1) Circle Class Use the Circle class from last week (private double variable radius, default constructor sets radius to zero, overloaded constructor sets it with a parameter, and methods setRadius, getRadius, getDiameter, getCircumference, and getSurfaceArea). Make sure that all getters are const. You can have all of your code in your header file and label the source file as intentionally blank. Create an overloaded + operator that returns a reference to a new circle that has a radius equal to the sum of the two input circles. Also implement an overloaded > operator that returns true if the Circle on the left is larger than the one on the right. These should be implemented as member methods, not friend methods. First test them with your own main program, after you have them using, use the provided driver to show that your class is properly defined

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_2

Step: 3

blur-text-image_3

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

Conceptual Database Design An Entity Relationship Approach

Authors: Carol Batini, Stefano Ceri, Shamkant B. Navathe

1st Edition

0805302441, 978-0805302448

More Books

Students also viewed these Databases questions

Question

=+What do they need to hear?

Answered: 1 week ago