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

P10-03: Cost of covering a cylinder We need to cover a closed, right cylinder wi

ID: 3734181 • Letter: P

Question

P10-03: Cost of covering a cylinder We need to cover a closed, right cylinder with a particular material. The cost of that material is C dollars per square foot The dimensions of the cylinder, R and H for radius and height, are given in inches. Write a function CostToCover that returns the cost to cover a closed, right cylinder Note that you'll have to convert from square inches to square feet, and then round up to the nearest square foot (the material can only be purchased in whole numbers). To round up in MATLAB, use the ceil function, for pi use the predefined MATLAB variable p. Example: for C 4.5, R 32, and H-73, the cost is 661.5000. Your Function Save Reset MATLAB Documentation 1 function cost CostTocover(C, R, H) cost =-1; end Code to call your function C Reset 1 CostTocover (4.5, 32, 73) Run Function Assessment Submit C=4.5R=32H = 73 , , Trouble with lab?

Explanation / Answer

function cost = CostToCover(C,R,H)
areaToCover = 2*pi*R*(R+H);
%covert area from square inches to square feet
areaToCover=0.00694444*areaToCover;
cost=C*areaToCover;
end