Question
C++ Make a program to calculate the volume of various containers. A base class, Cylinder, will be created, with its derived classes, also called child
C++
Make a program to calculate the volume of various containers. A base class, Cylinder, will be created, with its derived classes, also called child classes or sub-classes.
First, make a parent class, Cylinder. make a constant forpisince you will need this for any non-square containers. Useprotectedfor the members. Then, make apublicfunction that sets the volume.
Formula: V = pi * (r^2) * h
Part2:
c++ Make a derived, or child class for Cylinder, that is, a Cone class. The same function, with the same parameters, is used. However, the formula is different for a cone.
Formula: V = (1/3) * pi * (r^2) * h
Please ans both part
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started