Homework Assignments - Fall 2010
Introduction to Programming and Algorithm
Design (COP 1000)

Assignments, due dates, and hints are given below, most recent
first. Homework is due by midnight of the date shown. Send
your homework as an email attachment from your FSCJ email account
to sdifranc@fscj.edu.
Include your class, homework number, name, and reference
number in the subject line as described in the
homework guidelines. For example:
COP1000 Hw04 Billy Bob
Thornton Ref #999999
Note: If you are asking for help on an assignment, rather
than turning it in, make sure to include the word "Help" in
the subject line.
Hw02: Compound Interest
Write a program that will display the future value of an
investment that pays fixed interest, compounded monthly, for a
specified number of months. Prompt the user to input the principal
(amount deposited), term (in months), and an annual interest rate
(in percent). The formula for future value (fv) at the end of
any month t, with a principal p and a compound monthly
interest rate of r is:
fv = p(1 + r)t
When implementing this formula in Python, keep in mind:
- there is no implied multiplication; you must explicitly use
the * operator
- r must be converted from an annual to a monthly rate
(by dividing the annual rate by 12, and expressed as a decimal
(not a percentage).
Your program should have three functions:
- main(): Execution starts here
- splash(): Displays a "splash
screen" with program description
- futureValue(): Calculates and
returns the future value, given principal, term, and interest
rate
The structure of your program should be similar to this:
# hw02-jja.py -- 100913 (John
J. Astor)
# Compute future value of an investment
def main():
splash()
# input user values here (principal, rate, & term)
# call futureValue, display its return value
raw_input("Press <Enter> to exit.")
def splash():
# display program splash screen
def futureValue(p, r, t):
# calculate and return fv
main()
|
Here is a sample executable (download it by right-click, save it,
double-click to run on a computer with Python installed):
cdcalc.pyc
Save and submit your program with the filename
hw02-xxx.py, where
xxx are your initials.
Hw01: Simple IPO
Conversion Program
Using the Python IDLE Tutorial
program (in2cm.py) as a model, write a
program to convert between two other units of measure (for example,
miles to feet, gallons to liters, light years to parsecs, etc.).
Make sure you read and follow the homework
guidelines. Your program documentation (comments), variable
names, and user prompts should be appropriate for your conversion.
For an extra challenge (not extra credit!), write the program so
it converts the input into two (or more) other units of measure. For
example, convert pounds to kilograms and stones.
Save and submit your program with the filename
Hw01-xxx.py, where xxx are your initials.
|