Question: Problem 6: 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

Problem 6: 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: Ap, 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 p6a-evalc('help days.in month') (b) Set p6b-days.in month('jan',0) (c) Set p6c=days.in.month('feb'.0) (d) Set p6d-days_in month('feb',1) (e) Set p6e-days.in month('apr',0) (f) Set p6f days.in month('aug',1) (g) Set p6g=days-in-month('oct',0) (h) Set p6h-days_in month('nov',1) (i) Set p6i-days.in month("Dec',0)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
