clear
echo on
%Solution to problem 4
%In this problem we calculate the probability
%of a class going on a field trip.  The class
%goes if no more that 5% of the students forget
%their homework.  Thus the probability is the
%sum of the probability that 0,1,2,3,4, or 5
%students have forgotten it.  The probability
%of forgetting the homework for any one student
%is only 0.05  (5%).  We can thus calculate the
%probability by using the function prob(p,k,n)
%from today's example.  We have p=0.05, n=100,
%and k ranging from 0 to 5.  Thus the answer is:

trip_prob=sum(prob(.05,[0:5],100))

%so there is a bit less than a 2/3 chance that the
%trip will come off.
echo off