Question: A box can be represented by its dimensions, width, length and height. Then, the volume of the box is calculated by multiplying the dimensions, i.e.,

 A box can be represented by its dimensions, width, length and

A box can be represented by its dimensions, width, length and height. Then, the volume of the box is calculated by multiplying the dimensions, i.e., volume = width x length x height. Complete the source code file, sbt1.cpp, according to the following tasks: 1. Define a class named Box which consists of a. all the required attributes representing the dimensions, (3 marks) b. constructors (or a constructor with default arguments), (4 marks) c. mutators, (6 marks) d. accessors, and (6 marks) e. a method that calculates the volume. (3 marks) 2. Complete the definition of function printBox. This function prints the dimensions and volume of a box. (4 marks) 3. Create an array to hold 5 boxes and initliize the first and second boxes with specified dimensions. (4 marks) 4. Using a loop, set the dimensions the remaining boxes with values entered from the keyboard. (7 marks) 5. Using the function printBox and another loop, print all the boxes. (3 marks) 6. Calculate and print the total volume of all boxes. (5 marks) The following figure shows what your program should look like when it runs. Note that, the bold texts indicate keyboard input entered by the user. Enter box dimensions (W 1 h) -> 2 3 4 Enter box dimensions (W 1 h) -> 10 5 20 Enter box dimensions (W 1 h) -> 3 3 3 Dimension - 10 x 10 x 10 - 1000 Volume Dimension - 20 x 20 x 20 Volume - 8000 Dimension - 2 X 3 X 4 Volume - 24 Dimension - 10 x 5 x 20 Volume - 1000 Dimension - 3 x 3 x 3 Volume - 27 Total volume - 10051

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!