Question: USING C++ Consider the following class definition: class box { public: box(int = 1, int = 1, int = 1); // 1 point //default constructor

USING C++ Consider the following class definition:

class box { public: box(int = 1, int = 1, int = 1); //1 point //default constructor //sets width, length and height to the arguments given (in that order) //assume the arguments are not negative double volume(); //1 point //returns the volume of the box (reminder: volume is width*length*height) friend ostream& operator<<(ostream&, const box&); //2 points //overload the << operator so that if B is of type "box", with dimensions 2,5,3 //then, "cout<2 points //overloads * operator as a member function. //if B1 is of type "box", with dimensions 2,5,3 // then B2= B1*10 will result in B2 having dimensions 20,50,30. B1 will remain unchainged //assume the argument is not negative private: double width; //the width of the box double length; //the length of the box double height; //the height of the box };

Implement the functions and the operator overloads.

Partial Credit: for each function, you will get half the points for correct function header.

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!