Follow-through points | topic started 5/30/2001; 3:18:52 PM last post 5/31/2001; 10:41:06 PM |
|
|
|
|
|
Mark Schmitt - Re: Follow-through points 5/31/2001; 10:41:06 PM (reads: 2120, responses: 0) |
Zig, Even though my question was not completely clear, I think you have given me the answer I was looking for. Thanks. One of my fellow teachers likes to give multi-part questions where the answer to part one is used to find the answer to part two (and the answer to part two is used to find the answer to part three...). When grading by hand, if a student gets the wrong answer to part one, we as teachers can still grade the method of the later parts, even though the numbers will be wrong. I was looking for a way to access the answers the student types in so that the later answers can be based on these values. That way, a correct method will still yield an acceptable answer. I'm working with the following code: TEXT(EV2(<<EOT)); Simplify 4+7 = {NAMED_ANS_RULE(Answer1,5) } $PAR
EOT $ans1 = $11; &NAMED_ANS(Answer1,strict_num_cmp ($ans1)); $first_answer = $inputs_ref->{Answer1}; TEXT(EV2(<<EOT)); Three times your first answer is: {ans_rule(5) } EOT $ans2 = $first_answer; $ans2 =3*$ans2; &ANS(strict_num_cmp($ans2)); When I compile, I get the following error: * Use of uninitialized value in multiplication (*) at (eval 49) line 40. ##More details: -------- PG_priv::__ANON__ called at /usr/lib/perl5/5.6.0/i386-linux/Safe.pm line 222 ---- Safe::reval called at /home/httpd/webwork/system//PGtranslator.pm line 691 ---- PGtranslator::translate called at /home/httpd/webwork/system/cgi/cgi-scripts/processProblem8.pl line 420 If I remove the 3, everything seems to work ok. However, I want to be able to calculate with $first_answer. Any idea how I can do that? Thanks in advance. Mark |