CMIS 102 Exercises Modify the adder.py program to calculate the perimeter and area of a rectangle. Have variables to store the width and height of the rectangle. Calculate the perimeter and assign it to an appropriately named variable (hint: some name like "perimeter"). Calculate the area and assign it to a meaningfully named variable. Output the results. Bonus exercise: Add a third dimension (i.e. depth) so the object is a rectangular box. Calculate its volume. Calculate its surface area. Output the results. Modify the allOperations.py to input the two numbers. Write a program to compute gas mileage (MPG). Input the miles driven and the amount of gas used to do so. MPG = miles / gas Body Mass Index formulas: BMI = (Weight in Pounds / (Height in inches x Height in inches)) x 703 BMI = Weight in Kilograms / (Height in Meters x Height in Meters) Write a program that inputs weight and height in one or the other system, or both, and outputs the BMI. What's your BMI? Normal:20-25, Overweight:25-30, Obese:>30 Convert a Fahrenheit temperature to Celsius: Celsius = 5/9 * (Fahrenheit - 32) Convert a Celsius temperature to Fahrenheit: Fahrenheit = 9/5 * Celsius + 32 Test with 0C=32F 100C=212F Future Value = P*(1+r/n)**(n*t) P is present value (principal) r is interest rate (as decimal ) n is number of compoundings per year t is years To do exponentiation, use the ** operator. Test with P=1000, r=.1, n=10, t=10. FV should be 2704.81 Tetrahedron: Platonic/regular solid/polyhedron of 4 identical equilateral triangles. Surface area = math.sqrt(3) * side**2 Volume = math.sqrt(2)/12 * side**3 Write a program that inputs the side length and outputs the tetrahedron's area and volume. Test: s=1 SA=1.73205 V=0.117851 s=10 SA=173.205 V=117.851 Hero's formula: calculate area of triangle given lengths of its 3 sides a, b, and c. area = square root of product of s, s-a, s-b, and s-c where s is the semiperimeter, half the perimeter (sum of the 3 sides). Tests: 3,4,5 ->6 1,1,1 ->0.4330 1,1,1.41421 ->0.5 1,1.41421,1.7320 ->0.70711 2,2,1 ->0.96826