Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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 Design Application Development And Administration

Authors: Michael V. Mannino

4th Edition

0615231047, 978-0615231044

More Books

Students also viewed these Databases questions