The following is a fairly easy problem involving radio buttons. This is the line which is causing problem:
$choice0 = $a1*$b;
I don't understand why WeBWorK gave me a warning:
WeBWorK Warnings
WeBWorK has encountered warnings while processing your request. If this occured when viewing a problem, it was likely caused by an error or ambiguity in that problem. Otherwise, it may indicate a problem with the WeBWorK system itself. If you are a student, report these warnings to your professor to have them corrected. If you are a professor, please consult the warning output below for more information.
Warning messages
Use of uninitialized value $value in string eq at line 314 of [PG]/macros/parserRadioButtons.pl
Use of uninitialized value $value in string eq at line 314 of [PG]/macros/parserRadioButtons.pl
Carl Yao
Portland Community College
# WeBWorK problem written by Carl Yao
# Portland Community College
#
# Estimate the product of multiplication like 2856*4
#
# Last edited: Carl Yao 10/13/2016
#
DOCUMENT();
loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"PGML.pl",
"parserRadioButtons.pl",
"PGcourse.pl",
);
######################################
TEXT(beginproblem());
Context("Numeric");
$a = random(2,9,1);
$b = random(2,7,1);
$a1Exp = random(2,4,1);
$a1Ten = 10**$a1Exp;
$a1 = $a*$a1Ten;
$a1Close = $a1+10**($a1Exp-1)*non_zero_random(-2,2,1)+10**($a1Exp-2)*non_zero_random(-2,2,1);
$choice0 = $a1*$b;
$choice1 = ($a-1)*$a1Ten*$b;
$choice2 = ($a+1)*$a1Ten*$b;
$choice3 = $choice0*10;
$radio = RadioButtons(
[$choice0,$choice1,$choice2,$choice3],
$choice0, #correct
);
#####################################################
BEGIN_PGML
Without using a calculator, round the first number to a number easier to calculate, and then estimate the product.
[`` [$a1Close] \cdot [$b] \approx ? ``]
[@ $radio->buttons() @]*
END_PGML
############################################################
ANS( $radio->cmp() );
##############################################
BEGIN_PGML_SOLUTION
The correct answer is [`[@ $radio->correct_ans() @]*`].
END_PGML_SOLUTION
######################################
ENDDOCUMENT();