Since this is your assignment, I'll give you hints. I can give more hints if needed but you'll need to leave a comment showing where you're stuck.
Balance = 3500;
n = 30;
r = .06;
t = 1;
for i = t:n
Interest_Balance = Balance*(1+r).^i;
New_Balance = Balance+Balance*0.05;
end
disp(New_Balance);
Comments
[1] The exponent in the formula for compound interest is ^(n*t) where n is the number of times interest is compounded per year and t is the number of years (these are different variables than your 'n' and 't'). You're compounding annually so n=1 and you're looping over 1-year intervals so t=1.
[2] The variable name "Interest_Balance" leads me to believe you're misinterpretting the meaning of that variable. That variable contains the current value of the investment (principal + accrued interest). It's the updated balance.
[3] You're not using the New_Balance variable. You need to work that into the loop. Also, a cleaner way to write [B+B*.05] is [B*1.05]
[4] Somthing to think about after working out the other stuff: On his 65th birthday, does Randall make his final deposit before or after the interest is compounded for that year?
Best Answer