Question

In: Computer Science

In MatLab, Determine how many years it will take to accumulate at least $10,000 in your...

In MatLab, Determine how many years it will take to accumulate at least $10,000 in

your bank account if you deposit $1000 initially and $500 at the end of

each year. The account pays 2.5% interest annually. At the end of each

year your loop should write a message to the user, for example: "After

year 1, the balance in your account is $xx,xxx.xx". Your script should

also write out the final balance after $10,000 is reached.

Solutions

Expert Solution

% Matlab script to determine how many years it will take to accumulate at least $10,000
balance = 1000 ; % initial deposit
target_balance = 10000; % target balance to reach
deposit = 500; % deposit at the end of each year
interest_rate = 0.025; % interest rate annually
years = 0;% number of years
% loop that continues till the user has accumulated at least target balance
while balance < target_balance
years = years + 1; % increment the years
balance = balance+(balance*interest_rate); % calculate the interest accumulated at the end of the year
balance = balance + deposit; % add deposit at the end of the year
% display the balance at the end of the year
fprintf('After year %d, the balance in your account is $%.2f\n',years,balance);
end
% display the final balance
fprintf('Final balance after %d years : $%.2f\n',years,balance);
%end of script

Output:


Related Solutions

How many years it will take Judy to accumulate $30,000 if she invest $25,869 at 2.5%...
How many years it will take Judy to accumulate $30,000 if she invest $25,869 at 2.5% rate?
At 20% per year simple interest, how many years will it take SR 50,000 to accumulate...
At 20% per year simple interest, how many years will it take SR 50,000 to accumulate to SR 86,400 is closest to: (A) 3.5 years (B) 4 years (C) 4.5 years (D) 3 years
If Tyler Corporation invested $10,000 today, how many years will it take for it to double...
If Tyler Corporation invested $10,000 today, how many years will it take for it to double its investment if the annual interest rate is 6%? Round to nearest whole number. N= I =                                           PV = PMT = FV = P/Y=
At an annual interest rate of 7%, how many years does it take to quadruple your...
At an annual interest rate of 7%, how many years does it take to quadruple your money?   
- How many years will it take for $100,000 to grow to $500,000 if it is...
- How many years will it take for $100,000 to grow to $500,000 if it is invested at an annual interest rate of 9.15%? Round to the nearest 0.01. - You are offered a line of credit with a quoted interest rate of 20% with daily compounding. What is your effective annual interest rate? Round to the nearest 0.01%.
How many years will it take $7,000 to grow to $11,300 if it is invested at...
How many years will it take $7,000 to grow to $11,300 if it is invested at 3.25% compounded​ continuously?
How many years will it take $3,000 to grow to $5,700 if it is invested at...
How many years will it take $3,000 to grow to $5,700 if it is invested at 9% ​(A) compounded​ quarterly? ​(B) compounded​ continuously?
Mia Salto wishes to determine how long it will take to repay a ​$10,000 loan given...
Mia Salto wishes to determine how long it will take to repay a ​$10,000 loan given that the lender requires her to make annual​ end-of-year installment payments of ​$2,142. a.  If the interest rate on the loan is 14​%, how long will it take for her to repay the loan​ fully? b.  How long will it take if the interest rate is 11​%? c.  How long will it take if she has to pay 18​% annual​ interest? d. Reviewing your...
Nancy would like to accumulate $10,000 by the end of 3 years from now to buy...
Nancy would like to accumulate $10,000 by the end of 3 years from now to buy a sports car from her friend, Jim. She has $2,500 now and would like to save equal annual end-of-year deposits to pay for the car. How much should she deposit at the end of each year in an account paying 8 percent interest to buy the car?
How many years will it take for the balance left in a savings account to increase...
How many years will it take for the balance left in a savings account to increase from 2 of 2 $1,000 to $1,500 if interest is received at a nominal rate of 6% compounded semiannually throughout the period?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT