Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Suppose that $1000 is deposited into an account that pays 5% interest per year.

ID: 3864871 • Letter: S

Question

Suppose that $1000 is deposited into an account that pays 5% interest per year. At the end of each year, the amount in the account is 1.05 times the amount at the beginning of the year. Write a MATLAB program with a for loop to calculate the amount in the account after 10, 20, and 30 years. Repeat Problem 4.4, assuming that the interest is compounded quarterly; that is, one- fourth of the annual interest (1.25%) is added to the account every three months. Also, repeat the problem with monthly compounding. Calculate the amount in the account after 10, 20, and 30 years for both of these situations. For the account described in Problem 4.4, write a MATLAB program with a while loop to determine the number of years required for the amount in the account to reach $5000 if you have annual and quarterly compounded interest.

Explanation / Answer

4.4

principal = 1000;
rate = 5/100;
amount = principal;
for i=1:10
    amount = amount + amount*rate;
end
fprintf("After 10 year, amount= %d ",amount);


for i=11:20
    amount = amount + amount*rate;
end
fprintf("After 20 year, amount= %d ",amount);

for i=21:30
    amount = amount + amount*rate;
end
fprintf("After 30 year, amount= %d ",amount);

4.5

principal = 1000;
rate = 5/100;
amount = principal;
for i=1:10
    for j = 1:4
        amount = amount + amount*rate/4;
    end
end
fprintf("After 10 year, amount= %d if compounded quaterly ",amount);


for i=11:20
    for j = 1:4
        amount = amount + amount*rate/4;
    end
end
fprintf("After 20 year, amount= %d if compounded quaterly ",amount);

for i=21:30
    for j = 1:4
        amount = amount + amount*rate/4;
    end
end
fprintf("After 30 year, amount= %d if compounded quaterly ",amount);


amount = principal;
for i=1:10
    for j = 1:12
        amount = amount + amount*rate/12;
    end
end
fprintf("After 10 year, amount= %d if compounded monthly ",amount);


for i=11:20
    for j = 1:12
        amount = amount + amount*rate/12;
    end
end
fprintf("After 20 year, amount= %d if compounded monthly ",amount);

for i=21:30
    for j = 1:12
        amount = amount + amount*rate/12;
    end
end
fprintf("After 30 year, amount= %d if compounded monthly ",amount);

4.6

principal = 1000;
rate = 5/100;
amount = principal;
year = 0;
while amount < 5000
    amount = amount + amount*rate;
    year = year + 1;
end

fprintf("If compounded yearly, $1000 will take %d years to reach $5000 ",year);

amount = principal;
year = 0;
while amount < 5000
    for i=1:4
        amount = amount + amount*rate/4;
    end
    year = year + 1;
end

fprintf("If compounded quaterly, $1000 will take %d years to reach $5000 ",year);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote