|
CS 2073, Spring 2006 Program 3 Compound Interest Week 3: Jan 30 - Feb 3 Due (on time): 2006-02-10 23:59:59 Due (late): 2006-02-13 23:59:59 |
|
Program 3 must be emailed to:
nrwagner@cs.utsa.edu following directions for: running and submitting a C program, with deadlines:
|
Next try compound = 12, leaving the other numbers the same. This means that we are investing 1 dollar at 100% interest for 1 year, but compounding the interest every month. The result should be 2.613035290224 dollars, at 12-digit accuracy.
Next try compounding weekly, that is, compound = 52
Next try compounding daily, that is, compound = 365
Next try compounding hourly, that is, compound = 8760
Next try compounding each minute, that is, compound = 525600
Next try compounding each second, that is, compound = 31536000
for(compound = 1; compound <= 1000000000; compound = compound*10) {
// calculate compounded interest here
}
Enter amount, rate, and years --->1000.0 10.0 10 End of year 1: amount: 1100.00 End of year 2: amount: 1210.00 End of year 3: amount: 1331.00 End of year 4: amount: 1464.10 End of year 5: amount: 1610.51 End of year 6: amount: 1771.56 End of year 7: amount: 1948.72 End of year 8: amount: 2143.59 End of year 9: amount: 2357.95 End of year 10: amount: 2593.74
Notice that at the end of the first year, 100.0 interest is added to the 1000.0 you started with (10% of 1000.0). Then in the second year, the interest added is 110.0 (10% of 1100.0). And so forth.
Enter amount, rate, years, and compound --->1000.0 10.0 10 4 End of year 1: amount: 1103.81 End of year 2: amount: 1218.40 End of year 3: amount: 1344.89 End of year 4: amount: 1484.51 End of year 5: amount: 1638.62 End of year 6: amount: 1808.73 End of year 7: amount: 1996.50 End of year 8: amount: 2203.76 End of year 9: amount: 2432.54 End of year 10: amount: 2685.06
Notice that here the program is applying 2.5% interest 40 times. It is only printing every fourth time around the loop. The result after 10 years is somewhat bigger, but not too much (91.32 bigger).
compound final amount
1 2.000000000000
10 2.593742460100
100 2.704813829422
. . .
|
Contents of email submission
for Program 3: Last Name, First Name; Course Number; Program Number.
|