Question: 1 0 . Modify the following code to generate the given output. Do not modify the main function. 1 . #include < iostream > 2

10. Modify the following code to generate the given output. Do not modify the main
function.
1. #include < iostream >
2. using namespace std;
3.
4. class box {
5.
6. public:
7.// Constructor definition
8. box(double l =2.0, double b =2.0, double h =2.0){
9. length = l;
10. breadth = b;
11. height = h;
12.}
13.
14. double volume(){
15. return length * breadth * height; }
16.
17. private:
18. double length; // Length of a box
19. double breadth; // Breadth of a box
20. double height; // Height of a box
21.};
22.
23. int main(void){
24. box Box1(3.3,1.2,1.5); // Declare box1
25.
26. box Box2(8.5,6.0,2.0); // Declare box2
27.
28. return 0;
29.}
Output:
Number of box objects created so far: 1
Number of box objects created so far: 2

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!