Question
Design a SodaCan class that includes two double data members: the height and radius for a soda can. The header file is given as the
Design a SodaCan class that includes two double data members: the height and radius for a soda can.
The header file is given as the following:
#ifndef SODACAN_H
#define SODACAN_H
class SodaCan
{
public:
SodaCan(double h = 4.8, double r = 1.25);
double get_surface_area();
double get_volume();
private:
double height;
double radius;
};
#endif
a. Implement the constructor with two parameters.
b. Implement member function get_surface_area(). (Hint: surface area is the sum of two circle area (top and bottom) and side area which is equal to 2 * 3.14 * radius * height.)
c. Implement member function get_volume(). (Hint: the volume is equal to the base area times the height)
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