This shows how to use intervals in a problem.
Download file: WeightedGrader.pg
DOCUMENT();
loadMacros('PGstandard.pl', 'PGML.pl', 'PGcourse.pl');
Preamble
These standard macros need to be loaded.Setup
This perl code sets up the problem.BEGIN_PGML
* This answer is worth 20%. Enter 1: [___]{1}{ cmp_options => { weight => 20 } }
* This answer is worth 50%. Enter 3: [___]{3}{ cmp_options => { weight => 50 } }
* This answer is worth 30%. Enter 7: [___]{7}{ cmp_options => { weight => 30 } }
END_PGML
Statement
The default avg_problem_grader allows answers to be
assigned weights, i.e., given precedence in the problem score when the
problem is graded. Assign weights to answers by passing the
weight via cmp_options. The example here gives
weights as percents that sum to 100, but weights of
(2, 5, 3), (4, 10, 6), or
(0.2, 0.5, 0.3) would give the same weighting.
Note that if an answer is created as a MathObject in the problem
setup, then the weight can also be assigned by passing the
weight option to the cmp method directly as in
$ans->cmp(weight => 20).
BEGIN_PGML_SOLUTION Solution explanation goes here. END_PGML_SOLUTION ENDDOCUMENT();
Solution
A solution should be provided here.