Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The following script land calls function to: 1.) prompt the user for a land area

ID: 3822217 • Letter: T

Question

The following script land calls function to:

1.) prompt the user for a land area in acres

2.) calculate and return the area in hectares and in square miles

3.) print the results

One acre is 0.4047 hectares. One square mile is 640 acres. assume that the last function, that prints, exists--you do not have to do anything for that function. You are to write the entire function that calculates and returns the area in hectares and square miles, and write just a function stub for the function that prompts the user and reads. Do not write the actual contents of this function; just write a sub!

land.m

inacres = askacres;

[sqmil, hectares] = convacres(inacres);

dispareas(inacres, sqmil, hectares) %Assume this exists

Explanation / Answer

function f = askacres() %stub
f=5;
end

function [sqmil,hectares] = convacres(inacres)

sqmil = inacres / 640;
hectares = inacres*0.4047;
end

%land.m

inacres = askacres;

[sqmil, hectares] = convacres(inacres);

dispareas(inacres, sqmil, hectares) %Assume this exists