## WeBWorK Problems

### Currency context display options ### Currency context display options

by Carl Yao -
Number of replies: 0

Hello:

If the correct answer is $0.065, the Currency context automatically rounds it to$0.07 to show in the CorrectAnswer field. Is there a way to turn off this rounding? This way, students won't be confused when they see $0.07 as the correct answer, but WeBWorK grades$0.07 as incorrect.

Thanks!

Carl Yao

Portland Community College

Code:

DOCUMENT();

"PGstandard.pl",

"MathObjects.pl",

"PGML.pl",

"parserAssignment.pl",

"contextCurrency.pl",

"PGcourse.pl",

);

##############################################

Context("Numeric");

Context()->noreduce('(-x)-y','(-x)+y');

Context()->flags->set(showExtraParens=>0);

$m=random(1.5,6.5,1)/100;$b=random(11,19,1);

$x1=random(210,300,10);$y1=$m*$x1+$b;$x2=random(310,400,10);

$y2=$m*$x2+$b;

$x3=random(110,200,10);$y3=$m*$x3+$b;$x4=random(410,500,10);

$y4=$m*$x4+$b;

parser::Assignment->Allow;

$ansSI=Formula("y=$m*x+$b")->reduce; Context("Currency")->flags->set(noExtraDecimals=>0);$cy1 = Currency($y1);$cy2 = Currency($y2);$cy3 = Currency($y3);$cy4 = Currency($y4);$cm = Currency($m); ############################################## TEXT(beginproblem()); BEGIN_PGML By your cell phone contract, you pay a monthly fee plus some money for each minute you use the phone during the month. In one month, you spent [[$x1]] minutes on the phone, and paid [[$cy1]]. In another month, you spent [[$x2]] minutes on the phone, and paid [[$cy2]]. What is the rate (in dollars per minute) that the phone company is charging you? That is, what is the slope of the line if you plotted the bill versus the number of minutes spent on the phone? The rate is [__]{$cm}{width=>5} per minute.

END_PGML

ENDDOCUMENT();