Question: Please use Matlab Write a function days in month.m to display the number of days in a given month. The function should have the declaration:
Write a function days in month.m to display the number of days in a given month. The function should have the declaration: function days = days in month(month, leap) where the input month is an all-lower-case string denoting the first three letters of the month. The input leap has logical value (0 or 1) indicating the leap year. The output days displays the number of days in the input month. February has 28 days ( 29 days in leap year). The following months have 30 days: April, June, September and November. Other months have 31 days. In cases where the inputs are invalid, the output days should be the string 'Invalid inputs'. The function should include a description. Use nested switch statements. (a) Set p7a = evalc('help days in month'). (b) Set p7b = days in month('jan', o). (c) Set p7c = days in month('apr', 0). (d) Set p7d = days in month('aug', 1). (e) Set p7e = days in month('oct', 0). (f) Set p7f = days in month('nov!, 1). (g) Set p7g = days in month('feb', 0). (h) Set p7h = days in month('feb', 1). (i) Set p7i = days in month('Dec', o)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
