clear all;  close;

Interest = 0.05;
Deposit = 500;
Years = 10;
Balance = zeros(1,12*Years);  % Pre-allocate space for the vector Balance
Balance(1) = 1000;   % Initial Balance

for k = 2:12*Years
	Balance(k)  = (1+Interest/12)*Balance(k-1) + Deposit;
end

fprintf('Your final balance is: $%0.2f  \n',Balance(12*Years));
fprintf('Your total contributions are: $%0.2f  \n', Balance(1)+Deposit*(12*Years-1)); 

month = 1:12*Years;   % Create a vector of months:  [1 2 3 ... 12*Years]
plot(month,Balance,month,Balance(1)+Deposit*(month-1)); 
legend('Monthly Balance','Contributions');








