Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Create a class called box using the Box.h and Box.cpp files. It will have float members holding the lengths of the 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
Create a void function display that returns nothing and has no parameters, but prints out the dimensions in the following format
note there is a space before and after each
so if Boxdisplay is called on a box with dimensions what should be printed to the terminal is:
with an end: at the end
Create a parametrized constructor with float parameters, that will take in values for the dimensions of the box length width, height So if Box is called to create an instance of the object, the class members would be length width height 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
length width
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started