Q:

Most lap swimming pools have lanes that are either 25 yards long or 25 meters long; there’s not much of a difference. A function “convyards” is to be written to help swimmers calculate how far they swam

0

 Most lap swimming pools have lanes that are either 25 yards long or

25 meters long; there’s not much of a difference. A function 

“convyards” is to be written to help swimmers calculate how far they 

swam. The function receives as input the number of yards. It 

calculates and returns the equivalent number of meters, and, if (and 

only if) two output arguments are expected, it also returns the 

equivalent number of miles. The relevant conversion factors are:

1 meter = 1.0936133 yards

1 mile = 1760 yards

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

convyards.m

function [meters, varargout] = convyards(yards)

meters = yards / 1.0936133;

if nargout == 2

 varargout{1} = yards / 1760;

end

end

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now