Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please solve using Matlab !!!! To receive a thumbs up DO NOT USE CONDITIONAL STATEMENTS OR ITERATIONS!!!! I am also providing sample inputs and outputs

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed Please solve using Matlab!!!! To receive a thumbs up DO NOT USE CONDITIONAL STATEMENTS OR ITERATIONS!!!! I am also providing sample inputs and outputs below that are used in test cases. So please use them to prove that your code works. Only make one function for the problem!!

Test Case1 Inputs

goal1 = 2639708

intRates1 = 8x4 array seen below

40.7000000000000 89.8000000000000 95.4000000000000 0.900000000000000 84.4000000000000 42.9000000000000 54.3000000000000 91.5000000000000 61.5000000000000 33.4000000000000 54 64.3000000000000 37.7000000000000 59.7000000000000 31.1000000000000 0.100000000000000 87.7000000000000 90.2000000000000 7.10000000000000 3 78.5000000000000 70.2000000000000 18.2000000000000 20.8000000000000 46.5000000000000 37.7000000000000 9.30000000000000 45.5000000000000 81.4000000000000 73.5000000000000 46.3000000000000 12.7000000000000

loans1 = 8x4 array seen below

75663 58019 80092 19822 99548 53096 14251 19507 96243 90121 47847 32684 53507 54055 25684 88034 96387 43198 36909 47110 11563 54267 66176 40397 5145 71241 16961 17923 30435 1667 27878 96892

time1 = 8x4 array seen below

0 3 7 21 22 18 16 17 11 7 23 13 23 25 10 27 13 26 14 12 13 29 19 5 1 15 28 19 1 7 5 19

Test case1 Sample outputs using the above inputs

bankStatement1 = 'The bank reached their goal 2 quarters out of the year. The total expected interest is $11058111.03.'

expIntQuarterly1 = [4207525,4113076,1707032,1030477]

Function Name: numberworker Inputs: 1. (double) Mx4 array of loan amounts (principal) 2. (double) Mx4 array of interest rates (percent) 3. (double) Mx4 array of duration of loans (number of years) 4. (double) Amount representing interest goal Outputs: 1. (double) 1x4 vector representing total expected interest from loans in each quarter 2. (char) Sentence describing how many quarters goal was made Topics: (array math operations)(formatted strings), (masking) Background: You have landed a big job at Bank of Buzz after graduating from Georgia Tech. In an effort to impress your boss (and maybe get a raise), you decide to use your MATLAB skills to help loan profit analysis on the loans that the bank issued this year. Function Description: You are given 3 arrays, each column representing one of the 4 quarters in a business year. The first array (input 1) contains records of all of the loans that the bank gave out in a year (P in the formula). The second array (input 2) contains the interest rates for the corresponding loans given in percentages (r in the formula). Finally, the third array (input 3) contains the time that the loan was out for (t in the formula). Using the simple interest formula shown below, calculate the interest that the bank earns per loan (store this output in an array). I= Prt After you have calculated the interest, produce a sum for each column of the interest array. This gives you the total interest per quarter vector (output 1), round this value to 2 decimal places. Count how many quarters the bank met or exceeded their quarterly interest goal, calculate the total interest for the entire year (round to the nearest cent) and output a string with the following format (output 2): "The bank reached their goal quarters out of the year. The total expected interest is $.' Example: loans = [2000 5000 1050 3250 500 30000 100 6600; 5100 100000; 0 25000] intRates = [ 7.5 12.5 50 5; 16.6 10 14 4; 40 5 0 2] time [5 10 1 30; 5 10 15 20; 3 30 0 10] 10,000 goal bankStatement] numberWorker (loans, [expIntQuarterly, intRates, time, goal) expIntQuarterly [2221, 54500, 10760, 94900] bankStatement The bank reached their goal 3 quarters out of the year. The total expected profit is $162381.50.' Notes: Interest rates are given in percent form, so you must convert to a decimal before plugging in the formula. When displaying your yearly output in the sentence, ensure it is not in scientific notation and only 2 values are displayed after the decimal. (ex. $162381.50 rather than $162381.50 or 1.6238e+05) The yearly profit MUST be displayed as it is in the example, do not display in scientific notation or with any more than 2 decimal places. Your first output will likely display in scientific notation, this is okay. Remember, P = principal amount, r = interest rate, t = time in years), I = interest Make sure to calculate the yearly total by summing the rounded quarterly totals. Hints: If your string output looks off, remember that %d is not always the right choice for numeric values in the sprintf() function Function Name: numberworker Inputs: 1. (double) Mx4 array of loan amounts (principal) 2. (double) Mx4 array of interest rates (percent) 3. (double) Mx4 array of duration of loans (number of years) 4. (double) Amount representing interest goal Outputs: 1. (double) 1x4 vector representing total expected interest from loans in each quarter 2. (char) Sentence describing how many quarters goal was made Topics: (array math operations)(formatted strings), (masking) Background: You have landed a big job at Bank of Buzz after graduating from Georgia Tech. In an effort to impress your boss (and maybe get a raise), you decide to use your MATLAB skills to help loan profit analysis on the loans that the bank issued this year. Function Description: You are given 3 arrays, each column representing one of the 4 quarters in a business year. The first array (input 1) contains records of all of the loans that the bank gave out in a year (P in the formula). The second array (input 2) contains the interest rates for the corresponding loans given in percentages (r in the formula). Finally, the third array (input 3) contains the time that the loan was out for (t in the formula). Using the simple interest formula shown below, calculate the interest that the bank earns per loan (store this output in an array). I= Prt After you have calculated the interest, produce a sum for each column of the interest array. This gives you the total interest per quarter vector (output 1), round this value to 2 decimal places. Count how many quarters the bank met or exceeded their quarterly interest goal, calculate the total interest for the entire year (round to the nearest cent) and output a string with the following format (output 2): "The bank reached their goal quarters out of the year. The total expected interest is $.' Example: loans = [2000 5000 1050 3250 500 30000 100 6600; 5100 100000; 0 25000] intRates = [ 7.5 12.5 50 5; 16.6 10 14 4; 40 5 0 2] time [5 10 1 30; 5 10 15 20; 3 30 0 10] 10,000 goal bankStatement] numberWorker (loans, [expIntQuarterly, intRates, time, goal) expIntQuarterly [2221, 54500, 10760, 94900] bankStatement The bank reached their goal 3 quarters out of the year. The total expected profit is $162381.50.' Notes: Interest rates are given in percent form, so you must convert to a decimal before plugging in the formula. When displaying your yearly output in the sentence, ensure it is not in scientific notation and only 2 values are displayed after the decimal. (ex. $162381.50 rather than $162381.50 or 1.6238e+05) The yearly profit MUST be displayed as it is in the example, do not display in scientific notation or with any more than 2 decimal places. Your first output will likely display in scientific notation, this is okay. Remember, P = principal amount, r = interest rate, t = time in years), I = interest Make sure to calculate the yearly total by summing the rounded quarterly totals. Hints: If your string output looks off, remember that %d is not always the right choice for numeric values in the sprintf() function

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

Learning MySQL Get A Handle On Your Data

Authors: Seyed M M Tahaghoghi

1st Edition

0596529465, 9780596529468

More Books

Students also viewed these Databases questions