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

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!