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

Using MatLab WHILE-LOOP: Using a while-loop, determine the how many years are re

ID: 3685106 • Letter: U

Question

Using MatLab

WHILE-LOOP: Using a while-loop, determine the how many years are required for tuition to double if it increases by some percentage, r, every year. Read in both the tuition and the rate and for each year, output the tuition until the tuition is double its original value. If tuition is $3000 and it increases by 10% annually (i.e., 0.10), then you should output the following (Note: You MUST format the output the same but DO NOT hard code 3000 or 0.10)

Year 1 Tuition: $3000.00

Year 2 Tuition: $3300.00

Year 3 Tuition: $3630.00

Year 4 Tuition: $3993.00

Year 5 Tuition: $4392.30

Year 6 Tuition: $4831.53

Year 7 Tuition: $5314.68

Year 8 Tuition: $5846.15

Explanation / Answer

tution = input("Enter tution");
rate = input("Enter rate");
initial = tution;
tem = 0;
i = 0;
while tution < 2*initial
i = i+1;
X = sprintf('Year %d Tuition: $%.2f',i,tution);
disp(X)
tution = tution + tution * rate;
end

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