Question: Write a main function using C++ that declares two instances of Box (b1 and b2) with two different lengths and prints the volume of both

Write a main function using C++ that declares two instances of Box (b1 and b2) with two different lengths and prints the volume of both boxes.
class { Box 01: OZ: 03: 04: 05: 06: 07: 08: // Member functions visible to clients double volume( double vol); void length(int len); void width(double& wid); void height(double hei); 09: confidential: // Data only available to member functions double length_; // Length of a box double width_; // Width of a box double height_; // Height of a box } 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: double Box: volume { return length_ * width_ * height_; } 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: void length(double len) { if (len == 0) width_ = wid; } void Box:: Height(double hei) { if (hei >= 0) { height = hei; } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
