In: Mechanical Engineering
One bank pays 5.5 percent annual interest, while a second bank pays 4.5 percent annual interest. Determine how much longer it will take to accumulate at least $50 000 in the second bank account if you deposit $1000 initially and $1000 at the end of each year.
It is required to find out how much more time does it takes to accumulate $50,000 with 5.5% interest as compared to 4.5% if the deposit is $1000 initially and at the end of each year.
A while loop is used in this case as we do not know the number of years.
The MATLAB code is given below. We will generate two while loops to calculate the number of years required in both the cases.
Input:
% initializing year for one case
k = 0;
% initializing the initial amount
Amount1 = 1000;
while Amount1 < 50000
k = k + 1;
% calculating amount at each year
Amount1 = 1.055*Amount1 + 1000;
end
% initializing year for second case
m = 0;
Amount2 = 1000;
while Amount2 < 50000
m = m + 1;
Amount2 = 1.045*Amount2 + 1000;
end
% finding the extra time required
year = m - k
Output:
Year = 2
Therefore, it will take TWO more years to reach amount of $50,000 with interest rate of 4.5% as compared to 5.5%.
Therefore, it will take TWO more years to reach amount of $50,000 with interest rate of 4.5% as compared to 5.5%.