## Assignment 9 — problem solving

## Due Friday, February 2

### Program bean_count.py

- As always, it is strongly recommended that you carefully read the entire assignment before attempting to produce your solution.

- Based upon hours of research, zillions of jelly beans, and a bunch of mason jars, it has been concluded that the volume of a jelly bean can be roughly modeled as the average of the volume of the exterior bounding cylinder and of the volume of the interior bounding ellipsoid.

- Our formula for the volume
*j*of a single jelly bean is:

where

aandbare respectively the length and height of the jelly bean.

- Exhaustive research has determined the loading factor — the percentage of a jar that can be occupied by jelly beans — is
*constant*, with the constant being 69.8% (i.e., .698).

- Your task is to produce a program that separately prompts and reads three values,
the average length and height of a jelly bean (decimal values), and the size of a jar (integer value). The dimensions are in centimeters and the volume of the jar is in mLs (note: one mL equals one cubic centimeter).*their order being*

- The estimate for the number of beans that can fit in the jar is

v F/j

where

v,F, andjare respectively the volume of the jar, the loading factor, and the size of one jelly bean.

- Use the values to make an
estimate of the number of jelly beans that can be placed in the indicated jar.*integer*

- To make your estimate as accurate as possible, all computations should be decimal.

- To make your estimate as accurate as possible, use Python's estimate of π when needed.

- In meeting the problem requirement of producing an integer estimate,
your decimal estimate. The extra bean produced by rounding would not fit in the jar.*do not round*

#### Two different sample runs

Enter jelly bean length (cm): 1.52

Enter jelly bean height (cm): 0.9

Enter jar size (mL): 500

Estimate of jelly beans in the jar: 433

Enter jelly bean length (cm): 2.0

Enter jelly bean height (cm): 1.0

Enter jar size (mL): 25

Estimate of jelly beans in the jar: 13