Answered step by step
Verified Expert Solution
Link Copied!

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 1Create 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 privatelCreate a default constructor that sets each dimensions value to 1.0Create a void function display that returns nothing and has no parameters, but prints out the dimensions in the following formatL\times W\times Hnote there is a space before and after each xso if Boxdisplay 0 is called on a box with dimensions 4\times 5\times 6, what should be printed to the terminal is:4\times 5\times 6(with an end: at the end)Create a parametrized constructor with 3 float parameters, that will take in values for the 3dimensions 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 belength * width * heightand the formula for surface area would be12** length * width

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions