Question: Problem 1: C++ Design and implement a class box with three private variables length, width, and height and member functions to set length set height

Problem 1: C++

Design and implement a class box with three private variables length, width, and height and member functions to

  • set length
  • set height
  • set width
  • calculate volume

In your main program, declare and test functions for objects smallBox and largeBox of class box.

#include #include #include

using namespace std;

class Box { public: int length; int height; int width; int volume = length * height * width; };

void volume { volume = length * height * width; }

void smallVolume { (.75 * length) * (.75 * height) * (.75 * width); }

void largeVolume { (1.25 * length) * (1.25 * height) * (1.25 * width); }

int main() { Box.small = smallVolume; Box.large = largeVolume; return 0; }

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!