# WeBWorK problem written by Alex Jordan
# Portland Community College
#
# written for CAS 170 math review courselet
## DBsubject('')
## DBchapter('')
## DBsection('')
## KEYWORDS('')
## DBCCSS('')
## TitleText1('')
## EditionText1('')
## AuthorText1('')
## Section1('')
## Problem1('')
## Author('Alex Jordan')
## Institution('PCC')
##############################################
DOCUMENT();
loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"contextInequalities.pl",
"PGML.pl",
"answerHints.pl",
#"PCCmacros.pl",
"PGchoicemacros.pl",
"PGcourse.pl",
);
##############################################
Context("Inequalities-Only");
Context()->variables->add(X=>'Real');
#
# Allow commas every three digits in numbers
#
Context()->{pattern}{number} = '(:?(:?~~d{1,3}(:?~~,~~d{3})+|~~d+)(?:~~.~~d*)?|~~.~~d+)(?:E[-+]?~~d+)?';
Context()->{pattern}{signedNumber} = '[-+]?(:?(:?~~d{1,3}(:?~~,~~d{3})+|~~d+)(?:~~.~~d*)?|~~.~~d+)(?:E[-+]?~~d+)?';
Context()->flags->set(NumberCheck => sub {
my $self = shift; # the Number object
my $value = $self->{value_string}; # the original string
$value =~ s/,//g; # remove commas
$self->{value} = $value + 0; # make sure it is converted to a number
$self->{isOne} = ($self->{value} == 1); # set marker indicating if the value is 1
$self->{isZero} = ($self->{value} == 0); # set marker indicating if the value is 0
});
#Context()->update;
$m = random(3,7,1);
$n = random(3,7,1);
$p = random(69,73,1);
#$name = RandomName();
$name = "Alex";
@questions =
(
"There are fewer than 25,000 rhinoceroses left in Africa.",
"PCC has over 34,000 students.",
#"She's helped me out of a jam at least ".numberWord($m)." times before.",
"She's helped me out of a jam at least $m times before.",
#"You're allowed to mess up at most ".numberWord($n)." times before you are kicked off the team.",
"You're allowed to mess up at most $n times before you are kicked off the team.",
#"A masked bank robber was described as being ".numberWord($p)." inches tall. The police have said that $name is therefore ruled out as a suspect. What do we know about $name"."'s height?"
"A masked bank robber was described as being $p inches tall. The police have said that $name is therefore ruled out as a suspect. What do we know about $name"."'s height?"
);
@answers =
(
Compute("x < 25000"),
Compute("x > 34000"),
Compute("x>=$m"),
Compute("x<=$n"),
Compute("x!=$p"),
);
Context()->texStrings;
@solutions =
(
"The phrase 'fewer than' means strictly less than, so we should say that [`".$answers[0]."`].",
"Since we use the word _over_, there must be strictly more than 34,000 students, and we should say that [`".$answers[1]."`].",
"The phrase 'at least' means possibly that many and possibly more than that amount. So we should say that [`".$answers[2]."`].",
"The phrase 'at most' means possibly that many and possibly less than that amount. So we should say that [`".$answers[3]."`].",
#"We don't know if $name is taller or shorter than ".numberWord($p)." inches, but apparently $name is not exactly that tall. So we should say that [`".$answers[4]."`]."
"We don't know if $name is taller or shorter than $p inches, but apparently $name is not exactly that tall. So we should say that [`".$answers[4]."`]."
);
Context()->normalStrings;
@order = shuffle(5);
BEGIN_TEXT
@order
END_TEXT
$q0 = $questions[$order[0]];
$q1 = $questions[$order[1]];
$q2 = $questions[$order[2]];
$q3 = $questions[$order[3]];
$q4 = $questions[$order[4]];
$s0 = $solutions[$order[0]];
$s1 = $solutions[$order[1]];
$s2 = $solutions[$order[2]];
$s3 = $solutions[$order[3]];
$s4 = $solutions[$order[4]];
##############################################
TEXT(beginproblem());
BEGIN_PGML
Translate each of these English statements into an inequality like [`x<1`]. Try to _literally_ translate the expressions. For instance if you have 'more than 10' cents, write [`x>10`], not [`x\geq11`]. In each case, use [`x`] to represent the quantity that is referred to. The standard way to type the symbols [`\leq`], [`\geq`], and [`\neq`] is with *<=*, *>=*, and *!=*.
a. [$q0]
[____________]
a. [$q1]
[____________]
a. [$q2]
[____________]
a. [$q3]
[____________]
a. [$q4]
[____________]
END_PGML
##############################################
for my $i (0..4)
{ANS($answers[$order[$i]]->cmp);};
##############################################
BEGIN_PGML_SOLUTION
a. [$s0]**
a. [$s1]**
a. [$s2]**
a. [$s3]**
a. [$s4]**
END_PGML_SOLUTION
ENDDOCUMENT();