Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Opening the picture in a new tab will make it easier to view Roth IRA (loop, selection) O solutions submitted (max: Unlimited) Suppose you want

image text in transcribedimage text in transcribedOpening the picture in a new tab will make it easier to view

Roth IRA (loop, selection) O solutions submitted (max: Unlimited) Suppose you want to predict the value of your Roth IRA as you age. Create a function (RothIRA) that takes scalar inputs of the principal amount, contribution amount, annual interest rate and number of years. Your output will be a vector of the amount in your account the first day each year. Year one begins the day we open the account with our principal contribution. Assume that on the last day of the year, all interest is paid based on the amount in the account over the previous year and then the new contribution is added. Though this can be done without a loop (perhaps more efficiently), your program must use (at least) one loop. Hint: Use a for loop to generate the account value at the start of each year. For example, if there is $5500 in 2019 with an 8% interest rate, then there is $5500 + $440 (interest on the $5500) + $5500 (new contribution) = $11,440 in 2020, then $11,440 + $915.20 (interest on the $11,440) + $5500 (new contribution) = $17,855.20 in 2021, etc. Function C Reset DI MATLAB Documentation 1 %% Problem Template 2 %{ test cases: 4 p=1000; C=2500; r=0.05; n=5; -> V = [1000.00 3550.00 6227.50 9038.88 11990.82] 5 p=2000; c=3200; r=0.10; n=6; -> V = [2000.00 5400.00 9140.00 13254.00 17779.40 22757.34] 6 %} 8 function v - RothIRA(P, c,r,n) 9 % function v = RothIRA(P,c,r,n) 10 % p is scalar principal amount added on day one, c is the yearly 11 % contibution, r is the return rate, n is the number of years to simulate, 12 % v (vector) is the value of the account on the first day of the year. It 13 % will have the same number of elements as the value of n 14 format bank 15 16 %edit below this line 17 18 19 20 %edit above this line 21 22 return Code to call your function C Reset 1 format bank; 2 3 p=1000; C=2500; r=0.65; n=5; V = RothIRA(P, c,r,n); 5 disp(v); 6 7 p=2000; C=3200; r=0.10; n=6; 8 v = RothIRAP, C,r,n); 9 disp(v); Run Function Assessment: Submit Use a loop Random inputs Roth IRA (loop, selection) O solutions submitted (max: Unlimited) Suppose you want to predict the value of your Roth IRA as you age. Create a function (RothIRA) that takes scalar inputs of the principal amount, contribution amount, annual interest rate and number of years. Your output will be a vector of the amount in your account the first day each year. Year one begins the day we open the account with our principal contribution. Assume that on the last day of the year, all interest is paid based on the amount in the account over the previous year and then the new contribution is added. Though this can be done without a loop (perhaps more efficiently), your program must use (at least) one loop. Hint: Use a for loop to generate the account value at the start of each year. For example, if there is $5500 in 2019 with an 8% interest rate, then there is $5500 + $440 (interest on the $5500) + $5500 (new contribution) = $11,440 in 2020, then $11,440 + $915.20 (interest on the $11,440) + $5500 (new contribution) = $17,855.20 in 2021, etc. Function C Reset DI MATLAB Documentation 1 %% Problem Template 2 %{ test cases: 4 p=1000; C=2500; r=0.05; n=5; -> V = [1000.00 3550.00 6227.50 9038.88 11990.82] 5 p=2000; c=3200; r=0.10; n=6; -> V = [2000.00 5400.00 9140.00 13254.00 17779.40 22757.34] 6 %} 8 function v - RothIRA(P, c,r,n) 9 % function v = RothIRA(P,c,r,n) 10 % p is scalar principal amount added on day one, c is the yearly 11 % contibution, r is the return rate, n is the number of years to simulate, 12 % v (vector) is the value of the account on the first day of the year. It 13 % will have the same number of elements as the value of n 14 format bank 15 16 %edit below this line 17 18 19 20 %edit above this line 21 22 return Code to call your function C Reset 1 format bank; 2 3 p=1000; C=2500; r=0.65; n=5; V = RothIRA(P, c,r,n); 5 disp(v); 6 7 p=2000; C=3200; r=0.10; n=6; 8 v = RothIRAP, C,r,n); 9 disp(v); Run Function Assessment: Submit Use a loop Random inputs

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 2 Lncs 13427

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124251, 978-3031124259

More Books

Students also viewed these Databases questions