Question: Wi moodlemtech.mrooms 3.net Exercise 2.1. Script that uses runcnons rom the LaD I assigmment. The goal of this exercise is to create ooe seript and

 Wi moodlemtech.mrooms 3.net Exercise 2.1. Script that uses runcnons rom the

Wi moodlemtech.mrooms 3.net Exercise 2.1. Script that uses runcnons rom the LaD I assigmment. The goal of this exercise is to create ooe seript and two local functions from code that you creaned in Lab 1. Creating local functions means that the functions are defined inside of your seript, rather than saved separately in the Workspace. The firs function is CenvertTime. This function will take in one input tDays, and give three outputs tSeconds, tWeeks, and tYears. The purpose of the function is to convert a given time, in units of days, to three different times in units of seconds, weeks, and years. This is nearly the same as Exereise I.1, except that tDays is going to be a variable defined in the seript, nather than defined by the user and the input function. Additionally, you will need to use the fprintf function in your seript to return the statement below in the Comamand Window. Note, the highlighted numbers are dynamic based on the outputs of the ConvertTime function, ie. the numbers should change when the outputs change. You will be graded on getting the correct number of decimal places correct in the output statement. The eguivalent of 7.0 days is 604800 seconds, 1.0 weeka, 0.0192 yeara. The second function is PerformDivision. This function will take two inputs, a dividend Dvdnd and a divisor Dvsr, and return three outpots, the quoticat Quot, the remainder Remdr. and a logical eutput DvdedDividEva that will be a I if the dividend was divided evenly and 0 otherwise. This is nearly the same as Exercise 12, exeept that Dvdvd and Dvsr are going to be variables defined in the script, rather than defined by the user and the input function. Also note thut I have slightly renamed the variables from Exercise 1.2 to avoid any confusion. Additionally, you will need to use the fprintf function in your script to return the statement below in the Command Window: Note, the highlighted numbers are dynamic based on the outputs of the PerformDivision function, ie. the numbers should change when the outputs change. You will be graded on getting the correct number of decimal places correct in the output statement. Given the dividend of 29.0 and the divisor of 5.0, the guotient is 5 and the remainder is 4. Wan the dividend evenly divided by divisor? (0no,1yes)=0 Both functions need to have comments that describe the function's purpose, inpun(s), and outpet(s). The required format is written in the Lab02_Ex2_1_LastnameFirstname.m script on Moodle. Both fprintf statements need to have a camiage return at the end of the function statement. You will knew if you added the carriage return cotrectly if your Coemmand Window output looks like the output below. Note, each statement is on a new line and the >> is on its own line. The equivalent of 7.0 days 1 a 604800 seconds, 1,0 weeks, 0.019z years. Given the dividend of 29.0 and the divisor of 5.0, the quotient is 5 and the remainder is 4. Was the dividend eventy divided by divisor? (0no,1yes)=0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!