Answered step by step
Verified Expert Solution
Question
1 Approved Answer
this is matlab. I would greatly appreciate it if you satisfied all the assessments. The code is below but it does not satisfy all the
this is matlab. I would greatly appreciate it if you satisfied all the assessments. The code is below but it does not satisfy all the assessments. I need u to fix the code so all the assessments are satisfied.
* Display output with fprintf 1 solution submitted (max: 2) View my solutions Given a two-row matrix monthly deposit and years, write a code that displays the output as shown below. The monthly deposit will be $XXXX.XX in XX years. Hint: Use the vectorized fprintf Even if the grader marks as if your answer is correct, check your displayed out with the following carefully and try on your own MATLAB until you obtain exactly the same output. The monthly deposit will be $1495.00 in 5 years The monthly deposit will be $1218.00 in 6 years The monthly deposit will be $1020.60 in 7 years The monthly deposit will be $872.78 in 8 years The monthly deposit will be $758.13 in 9 years The monthly deposit will be $666.67 in 10 years For validating your code, assign your fprintf command line to the variable out_fprintf as shown below: out_fprintf = fprintf( your command); Function C Reset 1 function out_fprintf monthlydeposit(mon_yrs) 2 3 4 out_fprintf fprintf("The monthly deposit will be $%0.2f in %d years ", mon_yrs) 5 end Code to call your function 1 mon_yrs=[1495.00 1218.00 1020.60 872.78 758.13 666.67;5:10]; 2 out_fprintf=monthlydeposit(mon_yrs); Output The monthly deposit will be $1495.00 in 5 years The monthly deposit will be $1218.00 in 6 years The monthly deposit will be $1020.60 in 7 years The monthly deposit will be $872.78 in 8 years The monthly deposit will be $758.13 in 9 years The monthly deposit will be $666.67 in 10 years out_fprintf = 292 Output Previous Assessment: 0 of 2 Tests Passed * Your code returns the correct output for the given data. Variable output has an incorrect value. Check if your text string is exactly same as the sample output (spacing, upper and low case, changing the lines, conversion specifier, and so on). * Your code returns the correct output for the data different from the given ones. Variable output has an incorrect value. It seems you have made your output hard coded instead of vectorizing with the given vector inputStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started