prob2 - % variable called...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
%========================================================================== % PROBLEM 2 - Ice Cream Cones %-------------------------------------------------------------------------- % % Script Name: prob2 % Script Variables: % 1. amount (double) - Contains the amount of ice cream necessary to fill % an ice cream cone of the given dimensions % 2. time_to_fill (double) - The amount of time it takes to the fill an % ice cream cone, if each cone is filled at a rate of 1.0 in^3/s. % Answer should be in seconds. % % Problem Statement: % Write a script named "prob2" that will calculate the volume of ice % cream needed to fill an ice cream cone. The ice cream cone is 4 inches % tall and its rim has a diameter of 0.8 inches. Assume that the ice % cream completely fills the cone, and that the ice cream above the cone % is in the shape of a perfect hemisphere. Store the volume needed in a
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % variable called "amount". Also, assume that the cone is filled at a % rate of 1.0 in^3/s. Find the amount of time it takes to fill one ice % cream cone, and store that value in a variable called "time_to_fill". % % Note: Your answer should be in units of in^3. Don't convert to any % other unit of measurement such as ft^3, or yd^3. Also, don't forget to % include the hemispherical dome of ice cream above the cone. % radius_in=0.4; %pertains to cone and hemisphere, it is half of the diameter, which is 0.8 height_in=4.0; %pertains to cone volume_cone=(1./3).*pi.*radius_in.^2.*height_in; %units in^3 volume_hemisphere=(2./3).*pi.*radius_in.^3; %units in^3 amount=volume_cone+volume_hemisphere %units in^3 fill_rate=1.0; %units in^3/s time_to_fill=amount./fill_rate %final units in s...
View Full Document

Ask a homework question - tutors are online