Calculate the total volume due to spherical bubbles

Assignment Help Python Programming
Reference no: EM132356128

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/37tr3).

• A function that will accept the radius and height of a cylinder, then calculate and return the volume of a cylinder (vol = mr2h)

• 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.

Make sure your submission follows the assignment guidelines posted on Canvas. The value of pi may be declared globally as 3.14159. You may assume the user will enter values of correct data type.

Some example outputs are given below. The user's input is shown in bold.

Example :

Enter the height of the hunk of cheese in centimeters. 25.8

Enter the length of the hunk of cheese in centimeters. 40.67

Enter the width of the hunk of cheese in centimeters. 35.5

How many spherical bubbles are present? 10

What is the radius of the spherical bubbles in centimeters? 1.2

How many cylindrical holes are present? 8

What is the radius of the cylindrical holes in centimeters? 0.8

What is the height of the cylindrical holes in centimeters? 4

Reference no: EM132356128

Questions Cloud

Determine how you would improving talent management : "Improving Talent Management". Fewer than one-third of respondents to a survey say their company is prepared for the future. Even among the top companies.
Research various standard form of franchising : Research various standard form of franchising, post your assessment of franchising as potential sales-distribution strategy using at least one concrete example
Does terrorist activities promote public safety : Does media coverage of terrorist activities promote public safety or assist terrorist groups in spreading fear? (A Minimum of 300 Words).
How do you define diversity in brief : How, specifically, and to what degree should public administrators and public organizations be committed to workforce diversity? As a public administrator.
Calculate the total volume due to spherical bubbles : Calculate the total volume due to spherical bubbles and the total volume due to cylindrical pores, subtract the volumes of spherical bubbles.
Discussing the experiences with personality tests : Do you believe that personality tests can be used as a bonding tool with employees? Why, or why not? If you have experience with taking personality tests.
Critical issues in education : Investigate three resources (website, article, video, etc.) on topic of critical issues in early childhood education. What was the resource discussing?
Identify the socially optimal level of production : Describe how and why Microsoft fails to achieve productive efficiency in selling its Windows operating system under these assumptions
What techniques can you use to hold yourself accountable : Chapter 6 describes the idea of accountability and being accountable is critical today more than ever. Accountability can have both a positive and negative.

Reviews

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd