Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 8 Online
OpenStudy (anonymous):

PS2 question (also posted on edx site): I've declared all of my variables outside of my loop: http://pastebin.com/Q9VC74Q6 and then I've created variables under this line above: "A summary of the required math is found below". I did the problem in excel so I know what the answers should look like (and I've studied the test cases in excel too), however, my code return is off by a few: http://pastebin.com/xxiMvqY7. One issue I'm having trouble with is after month 1 because the first balance is the beginning balance but I get stuck on the previous balance.

OpenStudy (anonymous):

(I know my output isn't what's required; I've just tried to debug and printed all of my variables out so I can see what's going on.) (I have extensive ColdFusion coding but this is somewhat confusing.) For e.g.: the above suggested line is: Minimum monthly payment = (Minimum monthly payment rate) x (Previous balance) but for month 1 I have to use the start balance. The 2nd month requires 'previous balance' for which I've written: PreviousBalance = balance - MinimumMonthlyPayment. (I'm trying not to post but a line or two of code!) I think I'm on the right track but not quite there. Any help would be appreciated!

OpenStudy (anonymous):

Got it

OpenStudy (anonymous):

Would you mind posting the updated code so I can see where you went from there? I'm having trouble with this, myself.

OpenStudy (anonymous):

Not supposed to post code...where are you stuck? I'll try to help.

OpenStudy (anonymous):

This was the response I got which really helped me: posted by NeusIsern As you said, at the first iteration, the previous balance is obviously the initial balance. As for the following months, this "previous balance" or "updated balance" (or, really, I just called it "balance") must include the compound interest. Oh, I've just seen what might have confused you: Note that, even if they call it differently, Updated balance each month is the Previous balance for the next month.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!