Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

10/7/17 12:39 AM C:\Users\Mujtaba\Desktop\To Do...\part1.

m 1 of 1

function [ ] = part1(r,h)
% Homework 3.2 part 1
% a. Paint required
% r and h are in meters
V = pi*h*r^2; % Volume of cylinder
A = 2*pi*r*h + 2*pi*r^2; % surface area of cylinder
% calculates material cost. Assumed alumunium costs $3 per m^2
cost = 3*A; % cost in dollars
paint = V*1000; % paint required in liter
fprintf('Paint Required is %f liters\n',paint)
fprintf('Cost of material is $%f \n', cost)
end

You might also like