Homework 3: An interesting assignment

Assigned
Friday, September 9, 2016
Due
11 p.m., Monday, September 12, 2016
Summary
In this assignment, you will continue your practice writing interactive programs.
Collaboration
You will work with an assigned partner.
Submitting
Submit two Python programs using the online turnin form. See below.
Scoring
10 points

Precondition: Obtain the homework template

Download the homework template, template.py. This template contains some lines at the top that you and your partner should fill in. Failure to use the template may result in loss of points on the assignment.

For each of the files that you are to create, just save a copy of the template under that name.

This will be a precondition for every assignment where you program in Python.

Handling customer requests

As in the previous assignment, I would like you to ...
Note that these steps are iterative. As long as your program has bugs, you may need to rewrite your code, reconsider your design, reconsider the problem, or ask more questions about what the customer wants.

Request 1: Compound interest (interest.py)

You are contacted by Dr. Jan Crouter who is the chair of the Economics department at Whitman College. Her department has a new professor of finance. The new professor will need a general tool that their students can use to compute compound interest.

Dr. Crouter tells you the program should take the following inputs from the user:

The program should calculate and print the final amount of the investment, with interest, after the specified number of years have elapsed.

Note: Your program should ask for the inputs in the order specified. Failure to following this ordering will result in some point deduction.

Hint: The formula for computing compound interest is given in exercise 2.4.4. You may have already written a solution for a special case of this problem.

Request 2: Making an interesting story (madlibs.py)

I think Mad Libs™ are hilarious. Please write me a Mad Lib similar to the one in exercise 2.4.13. Your program should request at least five words from the user.

If you adapt a story from another source, make sure to cite that source in a comment in your program. Comments are meant for humans to read, rather than the computer. In Python, comments look like this:

# This is a short comment.


"""
This is a long ...
... long ...
... long comment.
"""

Of course, you are welcome to write your own story from scratch.

Submitting your work

Submit two files, interest.py and madlibs.py, using the turnin form.

Again, if you have any problems here, don't hesitate to ask your professor, or the lab aides or class mentors.


Janet Davis (davisj@whitman.edu) Thanks to Jan Crouter for humoring us.

Created September 2, 2016
Last revisedSeptember 09, 2016, 01:57:07 PM PDT
CC-BY-NC-SA This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.