Re: Java Newbie Needs Help
Your extensive calculations are wrong. (That doesn't make your program right - just saying.) After one year, the deposit is 105. But the next year, the 5% are calculated from that, so the third year should show 110.25.
I don't see an obvious error in the program, though. Perhaps store the result of Math.pow() in a temporary and write it out, so you can check what your program does.
Re: Java Newbie Needs Help
I admit I was a little lazy after doing the first year's calculation. Thanks for the correction. :P
But I will try out your idea ASAP.
Re: Java Newbie Needs Help
I was checking the math and it seems to be alright, then I noticed this part:
double rateOfInterest = Double.parseDouble(initialBalance);
the bold should be replaced with stringRateOfInterest
Re: Java Newbie Needs Help
Whoa, good catch! The dreaded copy&paste.
That's why I always use one variable for all temporary strings. I call it "t" or "temp" or something like that.
Re: Java Newbie Needs Help
Ahhh, I see. Thanks a lot!
That's what I get for programming late at night :P