A person in retirement is depositing $300,000 in a saving account that pays 5% i
ID: 3770583 • Letter: A
Question
A person in retirement is depositing $300,000 in a saving account that pays 5% interest per year. The person plans to withdraw money from the account once a year. He starts by withdrawing $25,000 after the first year, and in future years he increases the amount he withdraws according to the inflation rate. For example, if the inflation rate is 3%, he withdraws $25,750 after the second year. Write a program that calculates the number of years the money in the account will last assuming a constant yearly inflation rate of 2%. Make a plot (bar chart) in MATLAB that shows the yearly withdrawals and the balance of the account over the years. A person in retirement is depositing $300,000 in a saving account that pays 5% interest per year. The person plans to withdraw money from the account once a year. He starts by withdrawing $25,000 after the first year, and in future years he increases the amount he withdraws according to the inflation rate. For example, if the inflation rate is 3%, he withdraws $25,750 after the second year. Write a program that calculates the number of years the money in the account will last assuming a constant yearly inflation rate of 2%. Make a plot (bar chart) in MATLAB that shows the yearly withdrawals and the balance of the account over the years. A person in retirement is depositing $300,000 in a saving account that pays 5% interest per year. The person plans to withdraw money from the account once a year. He starts by withdrawing $25,000 after the first year, and in future years he increases the amount he withdraws according to the inflation rate. For example, if the inflation rate is 3%, he withdraws $25,750 after the second year. Write a program that calculates the number of years the money in the account will last assuming a constant yearly inflation rate of 2%. Make a plot (bar chart) in MATLAB that shows the yearly withdrawals and the balance of the account over the years.Explanation / Answer
% MATLAB script
year=0
P = 300000
D=25000
x = [P]
y = [D]
% while loop execution
while( P>0 )
interest = 0.05 * P;
P = P + interest;
x(end+1) = P;
inflation = 0.02 * D;
D = D + inflation;
y(end+1) = D;
P = P - D;
year = year + 1;
end
fprintf("Total years required is %d", year);
% Printing the Bar Chart
bar(x,y);
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.