CS21 Lab 1: Warmup programs

Due 11:59pm Tuesday January 29, 2008

This lab will require you to write some basic programs in python. A skeleton version of each program you will write will appear when you run update21. The program handin21 will only submit files in this directory.

Your programs are graded on both correctness and style. Please review the comments regarding programming style on the main page.

Email bio

Email me a brief biography of yourself. You can find my email address at the top of my home page. Your bio should include your preferred name, a description of any prior programming or linux experience (none is completely ok), your major or possible intended majors, and any extra-curricular activities that you would like to mention.

Age conversion
In the current directory, edit the file ageConvert.py to create a program that does the following:
This program can calculate an age in seconds, minutes, and hours.
Enter an age> 20
At age 20 you are:
175200 hours old
10512000 minutes old
630720000 seconds old
Assume that there are 365 days in each year (ignoring leap years).
Coin values
In the current directory, edit the file coinValue.py to create a program that does the following:
This program calculates the dollar amount of a collection
of coins.
Enter number of pennies> 3
Enter number of nickels> 4
Enter number of dimes> 5
Enter number of quarters> 2
Total dollar value: 1.23
Currency conversion
Choose your favorite two currencies and find out the exchange rate between them here. Then, in the current directory, edit the file currencyConvert.py to create a program that does something similar to the following:
This program shows Canadian dollar to Euro conversions.

Enter the starting dollar amount for the table: 10
Enter the ending dollar amount for the table: 60
Enter the step size for the table: 5

   C$  Euros
   10    6.6
   15    9.9
   20   13.1
   25   16.4
   30   19.7
   35   23.0
   40   26.3
   45   29.6
   50   32.9
   55   36.1
   60   39.4

Once you are satisfied with your programs, hand them in by typing handin21 at the unix prompt. You may run handin21 as many times as you like, and only the most recent submission will be recorded. This is useful if you realize after handing in some programs that you'd like to make a few more changes to them.