Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please code in Python and put all code in functions thank you. Goals: Developing problem-solving skills and functions Problem: You will create a program that

Please code in Python and put all code in functions thank you.

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Goals: Developing problem-solving skills and functions Problem: You will create a program that will approximate the volume of cheese in a rectangular hunk of Swiss cheese. For this approximation, you will assume that the holes in the Swiss cheese are of two types: spherical bubbles (all of the same size) or cylindrical holes (all of the same size) which are connected to the surface. The volume of cheese is the volume of the hunk of cheese minus the volume due to spherical bubbles and cylindrical holes. Your program should include 6 functions in addition to your main function. A function that will robustly confirm that the dimension entered is greater than zero. This function should accept the dimension and what it is such as "height of the hunk of cheese", radius of spherical bubble", etc. The function should return a valid value. A function that will robustly confirm that the number entered for spherical bubbles is greater than zero. This function should accept the number and if it is for spherical bubbles or surface cylinders. The function should return a valid value. A that function will accept the radius of a sphere then calculate and return the volume of a sphere (vol 4/3T3) A function that will accept the radius and height of a cylinder, then calculate and return the volume of a cylinder (vol h) A value returning function that accept the height, length, and width of a rectangular hunk of cheese then calculate and return the volume of the rectangular hunk of cheese (vol - hlw). A value returning function that will accept 8 parameters: width, length, and height of the rectangular hunk of cheese; the number of spherical bubbles and the radius of the bubbles; plus the number of cylindrical holes in contact with a surface and the radius and height of these cylinders. This function will call the functions to calculate the volumes of a single bubble and of a single cylindrical pore, calculate the total volume due to spherical bubbles and the total volume due to cylindrical pores, subtract the volumes of spherical bubbles and surface cylinders from the total possible volume of the rectangular hunk of chees. This final volume should be returned to the function call * * * * Your main function should ask the user to input the dimensions of the rectangular hunk of cheese, the number and size of the spherical bubbles, and the number and dimensions of the surface cylinders. For each of these 8 values your main function should call the functions to confirm input is greater than 0. After this confirmation, the function to approximate the volume of cheese should be called. Then the main function should output the approximate volume of cheese present. You may assume that the total volume of spherical bubbles and surface cylinders will not exceed the volume of the original hunk

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

Beyond Big Data Using Social MDM To Drive Deep Customer Insight

Authors: Martin Oberhofer, Eberhard Hechler

1st Edition

0133509796, 9780133509793

More Books

Students also viewed these Databases questions