what is an easy way to have commas after every three digits and currency or dollar sign, in my case $m may be a big number I need to show commas, $a , $b needs to show in the dollar sign, although I can add it manually. Since I am learning these scripts I must have other ways to do this formatting stuff.
DOCUMENT();
loadMacros(
"PGstandard.pl",
"PGchoicemacros.pl",
"PGgraphmacros.pl",
"PGcourse.pl",
"contextCurrency.pl" #this macro for currency
);
TEXT(beginproblem());
$showPartialCorrectAnswers = 1;
Context("Currency");
Context()->currency->set(comma=>'.',decimal=>',');
$a = non_zero_random(0,100,1);
$b = non_zero_random(0,40,1) ;
$x = non_zero_random(0,1000,1);
$y = non_zero_random(0,1000,1);
$m = $a * $x + $b * $y;
$n = $x + $y;
$NO_SPACE = '@{}';
BEGIN_TEXT
$BR
$BR
Tickets to a Broadway show cost $$a for adults and $$b for children. The total receipts for $n tickets at one performance were $$m. How many adult and how many child tickets were sold?
$BR
$BR
Number of tickets sold for adults was = \{ans_rule(20) \}
$BR
$BR
Number of tickets sold for children was = \{ans_rule(20) \}
END_TEXT
ANS(num_cmp($x);
ANS(num_cmp($y);
ENDDOCUMENT();