Question: Coding Question 1 Create a class called box using the Box.h and Box.cpp files. It will have float members holding the lengths of the 3

Coding Question 1
Create a class called box using the Box.h and Box.cpp files. It will have float members holding the lengths of the 3 dimensions of the box. You can name these: length, width, height. You MUST use the Box.h and can use the Boxcpp file for your class implementation. You can use the main.cpp file to run and debug your functions yourself. The unit tests assume the Box class is written in the Box.h and Box.cpp files. Remember its good practice to keep data members privatel
Create a default constructor that sets each dimensions value to 1.0
Create a void function display that returns nothing and has no parameters, but prints out the dimensions in the following format
LWH
note there is a space before and after each x
so if Boxdisplay 0 is called on a box with dimensions 456, what should be printed to the terminal is:
456
(with an end: at the end)
Create a parametrized constructor with 3 float parameters, that will take in values for the 3 dimensions of the box (length, width, height). So if Box (4,5,6) is called to create an instance of the object, the class members would be length =4. width =5. height =6(if you structured the members as said before).
Create functions setvolume and getsurfaceAreo that have no parameters and return a float. They should return the volume and surface area of the box based on its current stored dimensions.
In case you need it, the formula for volume would be
length * width * height
and the formula for surface area would be
12** length * width
 Coding Question 1 Create a class called box using the Box.h

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!