WeBWorK Problems

Accepting reduced fraction OR decimal

Re: Accepting reduced fraction OR decimal

by Brittni Lorton -
Number of replies: 0
I believe I spoke too soon. I have it working now with the below code. I believe I just had the studentMustRecuceFracionts=>1 in the wrong location of the code. Thanks!


###########################
# Initialization

DOCUMENT();


loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"parserAssignment.pl",
"PGML.pl",
"PGcourse.pl",
"contextFraction.pl",
);

TEXT(beginproblem());

##########################
# Setup

Context("Fraction");
$ace = Fraction("1/13")->cmp(studentsMustReduceFractions=>1);
$red = Fraction("1/2")->cmp(studentsMustReduceFractions=>1);
$club = Fraction("1/4")->cmp(studentsMustReduceFractions=>1);
$face = Fraction("3/13")->cmp(studentsMustReduceFractions=>1);



#################################
# Main text

BEGIN_PGML

One card is randomly selected from a deck. Find the following probabilities. Enter your answer as a reduced fraction.

+ P(an ace) = [_]{$ace}

+ P(a red card) = [_]{$red}

+ P(a club) = [_]{$club}

+ P(a face card) = [_]{$face}



END_PGML

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