Hi,
This is what i was doing for my hints. They appear as notes at the bottom of the page. For exemple, i cant see the first hint on the moodle version of the problem but i cant see the other hints for some reason.
DOCUMENT();
# Load whatever macros you need for the problem
loadMacros("PG.pl",
"PGbasicmacros.pl",
"PGchoicemacros.pl",
"PGanswermacros.pl",
"PGauxiliaryFunctions.pl",
"PGgraphmacros.pl",
"problemRandomize.pl",
"PGstandard.pl",
"MathObjects.pl",
"PGcourse.pl",
);
ProblemRandomize(when=>"always",onlyAfterDue=>0);
## Do NOT show partial correct answers
#install_problem_grader(~~&std_problem_grader); ##uncomment to use std grader
#install_problem_grader(~~&custom_problem_grader); ##uncomment to use custom grader
$showPartialCorrectAnswers = 1;
TEXT(beginproblem());
$k1 = list_random(0.001,0.012,0.032,0.017,0.0054,0.029);
$d1 = list_random(5,3,12,21,3,11);
$x1 = list_random(0.99,0.89,0.45,0.76,0.21,0.76);
$q1 = list_random(19,10,12,11,14,15);
$vcstr = ($x1*$q1)/ (3600*$k1*(1-$x1));
$vpfr = ($q1/(3600*$k1))*ln(1/(1-$x1));
BEGIN_TEXT
Soit la réaction suivante:$PAR
A -> B$PAR
s’effectuant dans un réacteur isotherme à une température donnée T. Calculer les volumes nécessaires afin d'atteindre une conversion X de l'espèce A de \($x1\)*100% dans un réacteur piston et parfaitement agité. Le débit molaire est de \($d1\) mol/h et le taux de réaction est:$PAR
- rA = kCa $PAR
\($k1\) s-1$PAR
Le débit volumique entrant est de \($q1\) dm3/h.$PAR
CSRT=\{ans_rule(40)\}litres$PAR
PFR=\{ans_rule(40)\}litres$PAR
END_TEXT
$ans = $vcstr;
&ANS(num_cmp($ans, reltol => 15));
$ans = $vpfr;
&ANS(num_cmp($ans, reltol => 15));
@hints = (
"Faites attention aux unités",
"Vous devez seulement utiliser une formule pour arriver à la réponse pour le volume du PFR et une autre pour le volume du CSTR.",
"Avez-vous pensé aux formules de design du PFR et CSTR",
"Il n'y a plus d'autre indice!!!",
);
install_problem_grader(sub {
my ($result,$state) = avg_problem_grader(@_);
if ($state->{num_of_correct_ans} == 0) {
my $n = $state->{num_of_incorrect_ans} - 1;
$n = $#hints if $n > $#hints;
if ($n >= 0) {
$result->{msg} .= '</i><p><b>Note:</b> <i>' if $result->{msg};
$result->{msg} .= $hints[$n];
}
}
($result,$state);
});
install_problem_grader(sub {
my ($result,$state) = avg_problem_grader(@_);
if ($inputs_ref->{AnSwEr1} eq 'reset') {
$state->{num_of_correct_ans} = 0;
$state->{num_of_incorrect_ans} = 0;
$state->{recorded_score} = 0;
$result->{score} = 0;
} elsif ($state->{num_of_correct_ans} == 0) {
my $n = $state->{num_of_incorrect_ans} - 1;
$n = $#hints if $n > $#hints;
if ($n >= 0) {
$result->{msg} .= '</i><p><b>Note:</b> <i>' if $result->{msg};
$result->{msg} .= $hints[$n];
}
}
($result,$state);
});
ENDDOCUMENT();
Thanks,
jp