Question: Write a function nexthour that receives one integer argument, which is an hour of the day, and returns the next hour. This assumes a 12-hour
Write a function nexthour that receives one integer argument, which is an hour of the day, and returns the next hour. This assumes a 12-hour clock; so, for example the next hour after 12 would be 1. Here are two examples of calling this function >> fprintf ('The next hour will be %d" " , nexthour (3) ) The next hour will be 4. >> fprintf 'The next hour will be sd. In',nexthour (12)) The next hour will be 1. Requirements 1) The function must be saved as an m-file and not *.mlx a) the function name must be nexthour 2) The function must have the following block comments a) Description of what the function does b) Format of the function call c) Description of the input argument(s) d) Description of the output arguments(s) e) Programmer name and date written 3) When I call your function I must not see any results displayed in my command window end statement 4) the function must return the correct result Here is a generic example of a typical function format: function [outputArgi,outputArg2- untitled3(inputArg1,inputArg2) %UNTITLED3 Summa % Call the function as % [outputArgl'outputArg2] = untitled3(inputArg 1,inputArg2) % Detailed explanation goes here % Detailed explanation goes here % Detailed explanation goes here % contiguous comment block ry of this function goes here Non-contiguous comments go here outputArgi-inputArg1 ;outputArg2-inputArg2; end %
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
