CS110 Introduction to Computing
Fall 2006

Lab Assignment#2

In this assignment you are required to solve two problems (in two separate Python programs).

Assignment:

Problem#1: When Americans discuss the fuel efficiency of automobiles they use miles/gallon (MPG) as their criteria. For example, a 1999 Mazda Protege lists its fuel efficiency as 22MPG (City) and 26MPG (Highway). Europeans and people in other countries that use the metric system typically use the litres/100-kilometers as their fuel efficiency criteria (i.e. how many litres will the car take to drive 100 kilometers). Write a Python program that takes a fuel rating in MPG and converts it to litres/100-kilometers. For your final output, pick a specific car, find out its rating (city and highway, for example at www.fueleconomy.gov) and show your program's output for that car. Make sure you mention the make, model, and year of the car in your write up.

Problem#2: Do programming Exercise 6 in Chapter 2 of Zelle (page 49). Show your program's output for a starting investment of $5000.00, a yearly investment of $1200 (starting in the second year), and an interest rate of 5% (APR).

What you will need to do

  1. For each problem, do the analysis as described in the text: clearly identify the input(s) and output(s) and the relationship(s) between them.
  2. Write the algorithm to solve each problem and then code it in Python.
  3. Make sure you do the above steps prior to entering the lab (or using your computer).
  4. Test and debug your program until it produces correct results.
  5. When done, print out the final version your your program and also a printout showing your program's output(s) on the example data above.
  6. Hand in your analysis, algorithm, printouts from Step 5.
  7. Make a blog posting saying that you have completed the assignment and also write up any logistical or other issues/questions raised while working on this assignment. Also write about your level of confidence on the concepts learned so far.

Notes:

Add the following line to all your Python programs:

# File: <place name of your program file here>

# Date: <date created>

# Created by: <your name>

# Assignment: <place assignment number here>

Back to CS110 Course Page