Question: Boxes Task : Evaluate whether you can load various sizes of jars into boxes. For each test, you will input the length, width, and height

Boxes

Task: Evaluate whether you can load various sizes of jars into boxes. For each test, you will input the length, width, and height of a box as well as the diameter and height of a cylindrical jar. The algorithm will determine whether each jar will fit in its corresponding box. The jar can sit upright in the box, or it can lie on its side with its top parallel to one of the sides of the box. Assume that a clearance allowance of .25 inch is needed in all three directions for the jar to fit in the box.

C++ program

Input: Use the following data, which can be found in the P4Boxes.txt file. Each row of data includes the 3 inner dimensions of a box (length, width, height) and the two outer dimensions of a jar (diameter, height). The dimensions are all in inches.

Box: Jar:

L W H D H

6.0 6.0 10.3 5.0 10.0

6.0 5.0 10.3 5.0 10.0

12.0 3.3 4.0 3.0 11.0

12.0 3.2 4.0 3.0 11.0

9.5 6.5 7.5 6.0 9.5

9.5 6.5 7.5 6.0 9.0

4.5 8.0 4.5 4.0 7.5

4.0 8.0 4.5 4.0 7.5

7.3 7.3 17.0 7.0 16.0

6.8 7.3 17.0 7.0 16.0

7.3 7.3 16.2 7.0 16.0

7.2 7.3 16.3 7.0 16.0

Output: Send the output to an external file. Line up decimal points in the output columns. The output file should include column labels, an appropriate header in addition to the column labels, the given points, and a yes or no verdict as to whether each jar will fit in its box.

Sample output (you may change the layout):

Box: Jar: Jar Fits?

L W H D H

6.0 6.0 10.3 5.0 10.0 yes

6.0 5.0 10.3 5.0 10.0 no

12.0 3.3 4.0 3.0 11.0 yes

Programming: Include at least one function in your program.

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!