Chat with us, powered by LiveChat 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 pro - Wridemy

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 pro

Use your first and last initials to name the two files you need to submit.

For example, when William J. Groen submits his work, the name of the file containing source code will be named "WGLab4.zip" and the name of the file containing screen shot for the execution of the program should be WGLab4.docx

Name Samir Khatri

Lab 4

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: 5-inch, 7-inch, 9-inch, 11-inch, and 13-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 calculateSphere that determines if the box will fit inside one of the five spheres.

The formula for calculating the diagonal of a rectangular box is:

Where = 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:

In this example, the diagonal is 7.07107 inches. A 7-inch sphere would not work. However, an 9-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 calculateSphere 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 calculateSphere function will return the value zero (0) to your main program. Otherwise, the function should return the size of the sphere that can hold the box; either 5, 7, 9, 11, or 13. 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.

Here is a sample output.

Please enter the length of the box:3.2

Please enter the width of the box:5.6

Please enter the height of the box:6.1

The diameter is: 9

This will fit in sphere of diameter 9

Do you want to calculate more sphere sizes? if so enter Y else enter N: Y

Please enter the length of the box:10

Please enter the width of the box:2

Please enter the height of the box:3

The diameter is: 11

This will fit in sphere of diameter 11

Do you want to calculate more sphere sizes? if so enter Y else enter N: Y

Please enter the length of the box:2.3

Please enter the width of the box:3.4

Please enter the height of the box:7.6

The diameter is: 9

This will fit in sphere of diameter 9

Do you want to calculate more sphere sizes? if so enter Y else enter N: N

Here is summary of the sphere needed

of Diameter 5: 0

of Diameter 7: 0

of Diameter 9: 2

of Diameter 11: 1

of Diameter 13: 0

does not fit: 0

Program Terminated

Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Ask A Question and we will direct you to our Order Page at WriteDemy. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.

Do you need an answer to this or any other questions?

About Wridemy

We are a professional paper writing website. If you have searched a question and bumped into our website just know you are in the right place to get help in your coursework. We offer HIGH QUALITY & PLAGIARISM FREE Papers.

How It Works

To make an Order you only need to click on “Place Order” and we will direct you to our Order Page. Fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Are there Discounts?

All new clients are eligible for 20% off in their first Order. Our payment method is safe and secure.

Hire a tutor today CLICK HERE to make your first order