Language: C++ Design and write an object oriented program for the computation of the volume of boxes (having a height, a width and a depth as double values). Your solution should have methods for setting and getting the height, the width and the depth of a box as well as constructors (a default con- structor and one which sets the data members), a copy constructor and a destructor. Name your files testbox. cpp, Box.cpp and Box.h. The program testing your code (testbox.cpp) should do the following: a) Enter from the keyboard the a value for n, the number of boxes that will be entered. b) Dynamically create an array of 2*n boxes. c) Enter from the keyboard the height, width and depth of each box one after the other for the first n boxes and the add their copies on the remainder n positions (in the same order). Use the сору constructor for doing this. d) Loop across all boxes, calculate and print on the screen the volume of each box. You can assume that the input will be valid.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter12: Adding Functionality To Your Classes
Section12.2: Providing Class Conversion Capabilities
Problem 6E
icon
Related questions
Question
Language: C++
Design and write an object oriented program for the computation of the volume of boxes (having
a height, a width and a depth as double values). Your solution should have methods for setting
and getting the height, the width and the depth of a box as well as constructors (a default con-
structor and one which sets the data members), a copy constructor and a destructor.
files testbox.cpp, Box. cpp and Box.h.
The program testing your code (testbox.cpp) should do the following:
Name
your
a) Enter from the keyboard the a value for n, the number of boxes that will be entered.
b) Dynamically create an array of 2*n boxes.
c) Enter from the keyboard the height, width and depth of each box one after the other for the
first n boxes and the add their copies on the remainder n positions (in the same order). Use
the copy constructor for doing this.
d) Loop across all boxes, calculate and print on the screen the volume of each box.
You can assume that the input will be valid.
Transcribed Image Text:Language: C++ Design and write an object oriented program for the computation of the volume of boxes (having a height, a width and a depth as double values). Your solution should have methods for setting and getting the height, the width and the depth of a box as well as constructors (a default con- structor and one which sets the data members), a copy constructor and a destructor. files testbox.cpp, Box. cpp and Box.h. The program testing your code (testbox.cpp) should do the following: Name your a) Enter from the keyboard the a value for n, the number of boxes that will be entered. b) Dynamically create an array of 2*n boxes. c) Enter from the keyboard the height, width and depth of each box one after the other for the first n boxes and the add their copies on the remainder n positions (in the same order). Use the copy constructor for doing this. d) Loop across all boxes, calculate and print on the screen the volume of each box. You can assume that the input will be valid.
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
ADT and Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage