Thank you so much, Alex. Although I do not understand these packages, it worked :) thank you again. But I had another issue with Currency. Can not I use more than one Context ? since after adding
Context("Numeric")->variables->add(y=>'Real');
parser::Assignment->Allow;
I go an error from the " Currency" context. it is in bold .
DOCUMENT(); # This should be the first executable line in the problem.
loadMacros(
"PGstandard.pl", # Standard macros for PG language
"MathObjects.pl",
"PGML.pl",
"contextCurrency.pl",
"PGcourse.pl",
"parserImplicitEquation.pl",
"parserAssignment.pl",
);
TEXT(beginproblem());
Context("Currency");
$showPartialCorrectAnswers = 1;
Context("Numeric")->variables->add(y=>'Real');
parser::Assignment->Allow;
$n=random(1,10,1);
$b=random(1,20,1);
$c=random(50,500,1);
$a=$n*$b;
$k=$a/$b;
$d=Currency($k*$c);
$f = Formula("y=$k*x");
BEGIN_PGML
State sales tax [`y`] is directly proportional to retail price [`x`]. An item that sells for [$a] dollars has a sales tax of [$b] dollars. Find a mathematical model that gives the amount of sales tax [`y`] in terms of the retail price [`x`]
The equation is [_______________]{"$f"}
What is the sales tax on a [$c] dollars purchase?
The answer is [_______________]{$d}
END_PGML
ENDDOCUMENT(); # This should be the last executable line in the problem.