Annotation of loncom/homework/templates/numPrePro.problem, revision 1.1

1.1     ! www         1: <problem>
        !             2: 
        !             3: <script type="loncapa/perl">
        !             4: #Enter the computations here
        !             5: $idx=&random(0,2,1);
        !             6: $season=('nice spring','hot summer','cool fall')[$idx];
        !             7: $temp=273+(20,30,10)[$idx];
        !             8: 
        !             9: sub abstemp {
        !            10:     my ($answer,$unit)=@_;
        !            11:     if ($unit=~/degC/) { $answer+=273; }
        !            12:     if ($unit=~/degF/) { $answer+=460; }
        !            13:     return $answer;
        !            14: }
        !            15: </script>
        !            16: 
        !            17: <startouttext />
        !            18: What is the temperature in Germany on a $season day?
        !            19: <endouttext />
        !            20: 
        !            21: <numericalresponse answer="$temp" id="11" preprocess="abstemp" unit="K">
        !            22:     <responseparam name="tol" type="tolerance" default="5" description="Numerical Tolerance" />
        !            23:     <textline readonly="no" />
        !            24: </numericalresponse>
        !            25: </problem>
        !            26: 
        !            27: 
        !            28: 
        !            29: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>