Computer Science Canada Interest Calc - Homework Question |
Author: | roer [ Sat Dec 06, 2003 7:28 pm ] |
Post subject: | Interest Calc - Homework Question |
I need help finishing off my interest calculatour for CompSci class, we've been doing Turing for about 3 weeks now and I'm kind of disorriented ![]() It would have to work like this though to give you an idea: month intrest 1 .00 2 .00 3 .63 (whatever intrest is) 4 .00 How would I go about making it skip like that? Its all I need to finish this program =) Thanks beforehand |
Author: | AsianSensation [ Sat Dec 06, 2003 11:36 pm ] |
Post subject: | |
I don't get how the interest could skip like that.........but anyways, here goes what I could make out of your question. I assume you start by asking the user to input some principle, some rate of interest and how many years they want to store it for, and how many times it compounds in a year. Then just input it into the formula (I'm assuming you know it) and run it through a for loop. The interest for each month would be whatever value you get subtract by the value you got from the last time the loop was run. So you need a temporary varible to hold last month's total. |
Author: | roer [ Sat Dec 06, 2003 11:44 pm ] | ||
Post subject: | |||
That is part of my code for calculating how the table will be put out. I basically have it like this 3 more times except they are for different values. |
Author: | AsianSensation [ Sat Dec 06, 2003 11:56 pm ] |
Post subject: | |
or you could just use this formula and plug in numbers while you run a for loop. Total = P(1 + r/n)^(Y*n) where P is the principle r is the rate (in decimal form, like 0.25 would be 25% interest) n is the amount of times it compounds in one year Y is the amount of years |
Author: | roer [ Sun Dec 07, 2003 2:42 pm ] | ||
Post subject: | |||
Thanks for all your help AsainSensation ![]() Would I have to set up a counter and use the mod function or something along those lines?
Should it be something along those lines? EDIT : Here's some bits Asain ![]() |
Author: | AsianSensation [ Sun Dec 07, 2003 5:07 pm ] | ||
Post subject: | |||
to compound more than once per year, just input it into the formula, here is an example.
the first output would be compounding quarterly for 5 years the second output would be compounding annually for 5 years btw, I really don't need bits, I've done all the customizing I could with the name, so you can have them instead. give roer bits |
Author: | roer [ Sun Dec 07, 2003 5:48 pm ] | ||
Post subject: | |||
Thanks for the code and bits Asain ![]()
|
Author: | Andy [ Sun Dec 07, 2003 7:35 pm ] |
Post subject: | |
wtf? azn dont be like mazer!! take those frigging bits back!!! +raondom amount of bits |
Author: | roer [ Sun Dec 07, 2003 8:13 pm ] |
Post subject: | |
Please? Anyone want to help ![]() |
Author: | roer [ Sun Dec 07, 2003 11:02 pm ] |
Post subject: | |
All right this is my final plea ![]() |
Author: | AsianSensation [ Mon Dec 08, 2003 12:17 am ] | ||
Post subject: | |||
I'm helping, I'm helping. Was just too busy watching TV, sorry bout that. Anyways, I really don't get why the interest jumps like that. Maybe it depends on the exact time that it compounds? I mean, like you said, if it compounds quarterly, then every 3 month, it should give you some interest. Well, just plug it into the formula. in the end it would be something like this:
|