Question: C++ Open Box An open box is made from a piece of rectangular cardboard by cutting out squares of equal size from the four corners
C++
Open Box
An open box is made from a piece of rectangular cardboard by cutting out squares of equal size from the four corners and bending up the sides. What size should the squares be to obtain a box with largest possible volume? The length and width of the cardboard are given by user.
Write a C++ program that uses function-driven style to solve this problem. Allow your program run again and again as often as the user wishes. With a function-driven program, the main function will contain only function calls, to call to all other functions. Variable declarations are allowed in the main function; besides that, nothing else is allowed.
For example,
For the entered sides 16 and 30 of the cardboard, the size of the cut is 3.33 and the maximum volume of the box is 725.93
For the entered sides 20 and 16 of the cardboard, the size of the cut is 2.95 and the maximum volume of the box is 420.11
Note: validate your input values to detect characters and negative values, which should be discarded. For a rectangle, we cannot say the length must be larger than (or smaller than) the width.
There is no need to use calculus. If you think that calculus is required, you're in a wrong way.
Requirement: The output should contain the following sentences:
The given length of the cardboard: 20
The given width of the cardboard: 16
The maximum volume of the open box: 420.11
The size of the cut: 2.95
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
