In the problem, the first answer must be entered in dollars. When the answer, $1000 for instance, is entered, it is scored correct, but the answer is changed in the answer box to $:1000 and apparently stored this way in the answer hash. It you resubmit the problem, it scores the "new" answer left in the answer box as incorrect. The problem's code is at the end of this note.
Thanks--rac
---------------NOTE: The graphing part was deleted to keep it short------------
DOCUMENT(); # This should be the first executable line in the problem.
loadMacros(
"PGstandard.pl",
"PGchoicemacros.pl",
"MathObjects.pl",
"PGgraphmacros.pl",
"contextCurrency.pl",
"answerHints.pl"
);
TEXT(beginproblem);
######################################
# Setup
#--------Define the function-----------
$x = random(5,20,5);
$y = random(3000,6000,1000);
$C = random(1000,2000,1000);
$k = ln($y/$C)/$x;
$f = Formula("$C exp($k*x)");
$interval = "<0,25>";
#------------Define the graph-----------------------
# NOTE: deleted the graph to make this more compact
#-----------------------Year-----
$year = random(1950,1990,5);
######################################
# Main text
BEGIN_TEXT
$BCENTER
GRAPH
$ECENTER
$BR
A deposit is made into an interest-bearing account. The figure above shows the balance, \(B\), in the account \(t\) years later.
$PAR
(a) What was the original deposit?
$BR
Answer: \{ans_rule(10)\}
$PAR
(b) If deposit was made in $year,when does the balance reach $DOLLAR $y?
$BR
Answer: \{ans_rule(10)\}
END_TEXT
######################################
# Answers
Context()->strings->add("No solution"=>{},
"Not defined"=>{},
"Does not exist"=> {},
"All real numbers"=>{});
Context("Currency");
$ans_a = $f->eval(x=>0)->with(tolerance=>0.15, tolType=>'absolute');
ANS(Currency($ans_a)->cmp);
Context("Numeric");
$ans_b = Compute("$year+$x");
ANS($ans_b->cmp->withPostFilter(AnswerHints(
Compute("$x") => "Did you enter the year?"
)));
######################################
ENDDOCUMENT(); # This should be the last executable line in the problem.