This demonstrates the Percent context.
Download file: Percent.pg
DOCUMENT();
loadMacros('PGstandard.pl', 'PGML.pl', 'contextPercent.pl', 'PGcourse.pl');
Preamble
The contextPercent.pl macro must be loaded.
Context('Percent');
$p = random(5, 95, 5);
$ans = Compute("$p %");
Setup
Select the Percent context, generate a random
percentage, and Compute the percent MathObject for the
answer. Note that the % symbol or the word
percent must be included in the Compute call
for the answer to be interpreted as a percent.
BEGIN_PGML
Enter [`[$ans]`]: [__]{$ans}
END_PGML
Statement
The answer can be entered with a % symbol or with the
word percent.
BEGIN_PGML_SOLUTION Solution explanation goes here. END_PGML_SOLUTION ENDDOCUMENT();
Solution
A solution should be provided here.