# Programming Assignment #6

## IDLE hands write devilish code.

### Introduction

In the first unit your programming assignment was normally one large assignment.  We haven't learned much about python yet so it is hard for us to do anything too big yet.  Instead, this assignment will ask you to use IDLE (review the video from the content materials for this week) to create three "short" scripts for some fictitious customers.  For each of these requests create a python script with the appropriate name.  Write and test your script to make sure it behaves as expected.

Customer Request #1 (hydrocarbon.py)

You are contacted by Dr. Al  Kyne who teaches chemistry at Whatsamata U.  He wants a tool that will allow him to calculate the molecular weight of certain hydrocarbons.

He tells you that :

• hydrocarbons are compounds made up of combinations of hydrogen, carbon, and oxygen.
• Each hydrogen has a molecular weight of 1.0079
• Each carbon has a molecular weight of 12.011
• Each oxygen has a molecular weight of 15.9994
• Thus, propyne which is C3H4 (3 carbons, 4 hydrogens, no oxygen ) has a molecular weight of 40.0646

He wants you to write a piece of code that prompts the user for number of hydrogen atoms, then number of oxygen atoms, then number of carbon atoms (in that order).  It then calculates and prints a nice message regarding the molecular weight of that hydrocarbon.

It might look something like this:

Customer Request #2 (bmi.py)

You are contacted by Mr. Jim Class who is a PE teach who wants to have an easy tool for calculating BMI. He asks you to create a simple python script which will read in a user's weight in lbs and their height in feet and inches (separately) and then calculate and print their BMI.

Remember that the formula for BMI is:

You will need to determine how to convert from lbs to kg and from feet/inches to meters.

Sample output might look like this:

Customer Request #3 (motorPool.py)

You are contacted by Mrs. Sue Barew who is the fleet manager for the cars owned by UNI. She wants you to create a simple python script which will help calculate the efficiency of the cars and see if the users were speeding. She asks you to write a program that takes in the car's mileage when the car leaves the motor pool, the cars mileage when it is returned to the motor pool, how much gas it took to fill up the car when it was returned, and how many hours the car reports that it was being driven. It will then calculate the total distance traveled, the miles per gallon and the miles per hour.

Sample output might look like this: