Q:

The following script land calls functions to:

0
  • prompt the user for a land area in acres
  •  calculate and return the area in hectares and in square miles
  •  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 in 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 

stub! 

All Answers

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

land.m

inacres = askacres;

[sqmil, hectares] = convacres(inacres);

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

askacres.m

function acres = askacres

acres = 33;

end

convacres.m

function [sqmil, hectares] = convacres(inacres)

sqmil = inacres/640;

hectares = inacres*.4047;

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