Question: In python Part 1: A Penny for a Gum Ball Mickey (40 pts) xperiment in selling gum balls, but we are going to make a
Part 1: A Penny for a Gum Ball Mickey (40 pts) xperiment in selling gum balls, but we are going to make a few assumptions. Assume that you are selling gum balls from a vending machine. The machine is a cube, and the gum balls are spheres. You check the machine once a week. The goal is to size the machine so that it is completely full at the start of the week, you never run out of gum balls before you get back to many gum balls left at the end of the week to go stale. We will make the assumption gum balls along any dimension of the cube is simply the side length divided by the diameter of the spheres. So if the side length is 9.0 and the gum balls have a radius of 0.5 exactly 9 gum balls would fit along each dimension, or 729 gum balls in total. This is known as a We are going to conduct an e check the machine, and you do rn ot have too gum that all the gum balls line up so that the number of Thanks for the Gum Ball! cubic lattice Do the following 1. First write two fumctions, find_volume_sphere (radius) and find_volume_cube(side) that calculate the volume of a sphere given a radius, and that calculate the volume of a cube given a side, respectively 2. Now ask the user for the radius of the gum balls and the weekly sales. 3. Calculate the total number of gum balls that need to fit in the machine as 1.25 times the weekly sales and use this to calculate the side length of the machine in terms of an integer number of gum balls. Hint: You know the total number of gum balls and in a cubic lattice you can fit the same number along each dimension, so if you can fit N gum balls along each dimension, then the machine holds N3 gum balls. The math module function ceil wil always round up and may be of use here. (We won't be cutting gum balls to fit them in the machine.) 4. Calculate a few more values: how many gum balls will actually fit given the dimension you chose (remember that there must be an integer number of gum balls along each dimension of the cube); the volume of the cube; the volume of the gum balls, and the wasted space if we put in both the number of gum balls we need to hold and how many we can hold. 5. Print these values out using the .2f format for all floating point values. Two examples of the program run (how it will look when you run t using Wing IDE 101) are provided in files hw2-part1 output 01.txt and hw2-part1 output 02.txt. (In order to access this file, need to download file hw02 files.zip from the Course Materials section of Submitty you wi and unzip it into your directory for HW 2.) We will test your code for the above values as wel as a range of different values
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
