Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started