Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please respond in C++ Write a C++ console application that will be used to determine if rectangular packages can fit inside one of a set

image text in transcribed

image text in transcribed

Please respond in C++

Write a C++ console application that will be used to determine if rectangular packages can fit inside one of a set of spheres. Your program will prompt the user for the three dimensions that define a rectangular box; the length, the width, and the height. The interior diameter of a sphere is used to identify its size. Spheres are available in the following five sizes: 4- inch, 6-inch, 8-inch, 10-inch, and 12-inch. Your program will execute repeatedly until the user enters a value of zero for one or more of the rectangular box dimensions. After obtaining the dimensions of the rectangular box, your program will call a function named getSphereSize that determines if the box will fit inside one of the five spheres. The formula for calculating the diagonal of a rectangular box is: D = VL+ W2 + H2 Where D = diagonal L = length W = width H = height All the dimensions are in inches. For example, a rectangular box that is 3 inches long by 4 inches wide and is 5 inches in height has a diagonal dimension that is calculated as follows: D = 132 +42 +52 D = V9+16 +25 D = 50 In this example, the diagonal is 7.07107 inches. A 6-inch sphere would not work. However, an 8-inch sphere could accommodate the box. Some of the dimensions of the boxes will be expressed as floating-point numbers, such as 4.5 or 3.75. The main program will keep track of how many of each of the five sizes of spheres will be needed. That is, how many 4-inch, 6-inch, 8-inch, 10-inch, and 12-inch spheres will be needed. Your program will use a function named get SphereSize to determine if a rectangular box can fit inside one of the spheres. The function will receive as arguments the three dimensions of the box. If the box is too big to fit inside any of the spheres, the getSphereSize function will return the value zero (O) to your main program. Otherwise, the function will return the size of the sphere that can hold the box; either 4, 6, 8, 10, or 12. The main program will report to the user which size sphere will work or if none will work for each of the rectangular boxes. When the program terminates it will report how many of each size spheres will be needed

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_2

Step: 3

blur-text-image_3

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

Database Principles Programming And Performance

Authors: Patrick O'Neil, Elizabeth O'Neil

2nd Edition

1558605800, 978-1558605800

More Books

Students also viewed these Databases questions

Question

Does the firm leverage its core competencies?

Answered: 1 week ago

Question

=+Where does the focus of labor relations lie? Is it collective

Answered: 1 week ago