next_inactive up previous


COMP 11 - Introduction to Computer Science - Fall 2002

Project pp1

Programming project due the week of 9/17

Due dates:
 
Section 01 (Block H): Wednesday 9/19 11:00 pm
Section 02 (Block E): Thursday 9/20 11:00 pm
Submissions may begin on Monday 9/17 at 5pm.

Project p1: 2 points. Calculate the cost of a mortgage per minute of operation

This is the first part in the semester long Car Wash project. Here we will make a simple calculation of the amount of money that the car wash owner must pay to the mortgage company for every minute the car wash is open during the first year. The cost of the mortgage is based on the amount owed on the loan - the principle - and the interest charged by the mortgage company. Thus, the per-minute cost decreases by staying open more minutes per day. Of course, by staying open more there are more costs and, potentially, more business, so deciding how long to stay open each day is a difficult one. For this project we are concerned only with the mortgage cost.

We will use a simple formula for calculating the interest on the loan and the cost of the mortgage for the first year. Let's say that the principle at the start of the year is $100,000, the interest rate is 8%, and the length of the loan is 20 years. The interest charge for the year is a simple calculation: 8% of the principle of $100,000, or $8,000. Since the loan must be paid off in 20 years, the owner must pay off 5% of the principle each year, or $5,000. Thus the yearly cost of the loan is $13,000. When given the number of minutes the car wash is open, it's simple to calculate the average cost per minute.

However, we will not give you the number of minutes but instead the number of days per week and the number of hours per day that the car wash is open. For this project, assume that a year has exactly 52 weeks (a year actually has 52$ {\frac{{1}}{{7}}}$ weeks per year in non-leap years).

More formally, here is what your program must do. It must prompt for and read the following data in order.

Then it must calculate the average cost of the mortgage per minute of operation and print it.

Here is a sample run of your program. The first '%' is the Unix prompt. The characters in italics are those typed by the user.

a.out

This program calculates the average per-minute cost of a mortgage.

Enter the principle in dollars: 100000

Enter the interest rate in percent: 8

Enter the length of the loan in years: 20

Enter the number of days open per week: 7

Enter the number of hours open per day: 12

The per minute cost of the mortgage is $0.0496

Notice that the cost is shown with 4 decimal places-you should do the same.

Note also that the final answer is preceded by a '$'. It is very important that your program print this '$' just before your answer and nowhere else. The grading program is rather stupid. To find your answer, it scans for a '$' and reads the floating point number that immediately follows it. If there is no '$', then it assumes there is no answer.

How to submit your program

At this time, we have not decided which submission system we will use this semester (there are two choices), so we cannot give you directions. However, we will post directions on the web page by Monday 9/16 5:00 pm in an announcement. Announcements appear near the top of the page in a bright color. The web page is at:

http://www.eecs.tufts.edu/comp/11

No matter which submission system we use, you must have your program on the Andante computer in a file. If you have developed your program directly on Andante, you are ready to submit. If you have developed it on another computer, say your personal computer, then you must copy it to Andante, and then submit it. (its internet address is andante.eecs.tufts.edu). Directions for copying files to Andante by either FTP or email will also be posted on the course web page.


next_inactive up previous
Webmaster for COMP 11