CPSC120A
Fundamentals of Computer Science I

Lab 6

Parameters and Arguments

Use the command line to create a new directory called lab6 in your labs directory. Make sure all of the .py files that you create for this activity are in that directory.

Storm Distance

When I was little my brother told me that the number of seconds between when you see a lightning bolt and when you hear the thunder clap is the number of miles away the storm is. The theory is correct, you can approximately determine how far away a storm is by measuring the time between the bolt and the clap, but sound travels slower than 1 mile per second. Create a program that can calculate the distance more accurately.

Create a function called calculate_storm_distance in a file called storm.py. The function should print the number of miles away a storm is given the number of seconds between seeing a lightning bolt and hearing a thunder clap. Assume the speed of sound is 0. 211 miles per second.

Paint Gallons

My wife wants to repaint our bedroom. In order to save a little money I'm going to do it myself, but I don't want to buy more paint than I will need. Create a program that can help calculate the number of gallons of paint to buy given the dimensions of a room.

Create a function called calculate_paint_gallons in a file called paint.py. The function should print the number of gallons of paint that are required to paint walls of rectangular room given the length, width, and height of the room, in feet. Note, that the floor and ceiling do not need to be painted. Also note, the number of gallons should be a whole number that is sufficient to paint the entire room. You can use the math module's ciel function and the built-in int function to help convert the exact number of gallons to a whole number. Assume that paint can cover 350 square feet of wall per gallon.

Submission

Please show your source code and run your test cases for the instructor or lab assistant. Only a program that has perfect style, thorough test cases, and flawless functionality will be accepted as complete.