Create a class called box whose constructor function is passed three double values, each of which represents the length of one side of a box.Have...

      

Create a class called box whose constructor function is passed three double values, each of which represents the length of one side of a box.Have the box class compute the volume of the box and store the result in a double variable.Include a member function called vol() that displays the volume of each box object.

  

Answers


Davis
#include
using namespace std;
class box {
double l, w,h;
double volume;
public:
box(double a, double b, double c);
void vol();
};
box::box(double a, double b, double c)
}
l = a;
w = b;
h = c;
volume = l* w*h;
}
void box::vol()
{
cout << "Volume is: "<}
int main()
{
box x(2.2, 3.97, 8.09) , y(1.0, 2.0, 3.0);
x.vol();
y.vol();
return 0;
}
Githiari answered the question on May 5, 2018 at 17:53


Next: Create a class C++ class called t_and_d that is passed the current system time and date as a parameter to its constructor when it is...
Previous: Explain ways through which the church promotes responsible sexual behavior

View More Computer Science Questions and Answers | Return to Questions Index


Exams With Marking Schemes

Related Questions