twoodcc said:
thanks. i'm trying. it seems my programming is not very organized though
If you're getting bogged down with long and hard to visualise code, try breaking it down.
Make a part that calculates the interest, and another bit that deals with the payments, etc, and only put them together at the end. Flowcharts are great for this stuff.
You obviously need counters to tell how long the time past is for your output.
I would suggest an overall While loop (while amount_owing > 0) which contains a for loop (For i=1:12 (or whatever it is)) to simulate the months, which you would count, and then every time the for loop ends, you add a year, and reset the month counter to zero.
Of course, in the for loop, you would put all your monthly calculations. Easy!
And of course output the years and months.
Hope this helps. I did an Engineering orientated Matlab intro course for Uni last semester. Great program. Good luck!
Oh, and by the way, who really does assignments like that on their own? It's called collaboration, and it's a good thing for everyone involved. Other than being a nice thing to do, helping others with their assignments (Which are just extensions of learning) helps them learn how to do it in the future, doesn't waste the "professor"'s time in explaining, and also helps the person who's explaining gain a firmer knowledge of the material. It is my belief that anyone not willing to offer help has forgotten that the purpose of assignments is not to make people fail, but to make learning assessible.
Hmmm... It seems this rant has gone way over the top, and really wasn't warranted, but it's too good to waste, so...
Cyaz!