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 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
image text in transcribed

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

Real Time Database And Information Systems Research Advances

Authors: Azer Bestavros ,Victor Fay-Wolfe

1st Edition

1461377803, 978-1461377801

More Books

Students also viewed these Databases questions