Question: Most of a modular program has been written that will calculate and print the volume of a cone. The scrpit coneprog calls a function that

Most of a modular program has been written that will calculate and print the volume of a cone. The scrpit "coneprog" calls a function that prompts for the radius and the height, error-checking for each, another function to calculate the volume and then a third function tht prints the results. The script and the "conevol" function have been written for you. A function stub has been written for the printvol" function; you do not need to modify that. You are to fill in the "get_vals" function, which must use a local function "readitin". Use radius = 25 and height = 12 coneprog.m [rad ht] = get_vals('radius', 'height'); vol = conevol(rad, ht); printvol(rad, ht, vol) function vol = conevol(rad, ht) vol = (pi/3) * rad .^2 . ht; end function printvol(rad, ht, vol) disp(rad) disp(ht) disp(vol) end function Couti, out2] = get_vals(first, second) outi = readitin(first); out2 = readitin(second) end function out = readitin(word)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
