The value of a savings account, V, after t years is given by: V = P(1 + r/100/n)
ID: 1996692 • Letter: T
Question
The value of a savings account, V, after t years is given by: V = P(1 + r/100/n)^nt where P is the initial investment, r is the yearly interest rate in percentage (e.g. 7.5 percentage entered as 7.5), and n is the number of times per year that the interest is compounded. Write a MATLAB program in a script file that calculates V When the program is executed it asks the user to enter the amount of the initial investment, the number of years, the interest rate, and the number of times per year that the interest is compounded. The output is displayed in the following format: "The value of a dollar XX investment at a yearly interest rate of X.X percentage, compounded X times per year, after XX years is dollar XXXX.XX", where XXX stands for the corresponding quantities. Use the program you wrote in part a to determine the value of a dollar 20,000 investment after 18 years if the yearly interest rate is 3.5 percentage compounded 6 time a year.Explanation / Answer
a. Code :
P=input('initial investment,P=');
r=input('yearly interest rate in %,r=');
n=input('number of times per year that the interest is compounded ,n=');
t=input('number of years,t=');
V=P*((1+(r/(100*n)))^(n*t));
fprintf('The value of a $ %6.1f investment at a yearly interest rate of %3.1f, compounded %2.1f times per year, after %3.1f years is $ %6.2f ',P,r,n,t,V);
return
b. Result:
initial investment,P=20000
yearly interest rate in %,r=3.5
number of times per year that the interest is compounded ,n=6
number of years,t=18
The value of a $ 20000.0 investment at a yearly interest rate of 3.5,
compounded 6.0 times per year, after 18.0 years is $ 37483.54
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.