This forum has a limit to the number of forum postings you can make in a given time period - this is currently set at 10 posting(s) in 1 day

Paul and Gavin,

Thanks for your suggestions. I should tell you that I have almost zero experience in authoring WW problems... so here is what I could do by following your suggestions. I used the first template that Paul sent me (with parserMultiAnswer - thanks Gavin for the link ), stole some problems from the library, then I combined them into a a problem that asks the student to solve only ONE of the three parts. The only thing that doesn't come out right is the "results" column in the table after the answers are entered. If I enter a correct answer for one of the parts, it marks them all "correct" highlighted in green. However, under messages I do get the correct feedback. Any idea how I could fix that?

Thanks again.

Alina

DOCUMENT();

loadMacros(

"PGstandard.pl",

"MathObjects.pl",

"parserMultiAnswer.pl","parserAssignment.pl", "AnswerFormatHelp.pl",

"parserNumberWithUnits.pl",

);

TEXT(beginproblem());

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

# Setup

Context("Numeric")->variables->add(

y=>"Real", k=>"Real"

);

parser::Assignment->Allow;

$a = random(2,9,1);

do { $b = random(2,5,1); } until ($b != $a);

$ab = $a * $b;

$ansa = Compute("y = k * e^(x^2/2 + $b x) - $a");

$ab=random(48,240,16);

$bb=$a/16;

$ansb= "-16*($bb/2)**2+$ab*($bb/2)";

Context("Numeric")->variables->add(y=>"Real");

parser::Assignment->Allow;

$ac = random(2,5,1);

do { $n = random(2,8,1); } until ($n != $ac);

$np1 = $n + 1;

$ansc = Compute("y = $ac e^((x^$np1 - 1)/ $np1 ) ");

$multians = MultiAnswer($ansa, $ansb, $ansc)->with(

singleResult => 0,

allowBlankAnswers => 1,

checkTypes => 0,

checker => sub {

my ( $correct, $student, $answerHash ) = @_;

my @c = @{$correct};

my @s = @{$student};

my @score = ();

my $totalscore = 0;

foreach my $j (0..2) {

my $j1 = $j + 1;

if ($c[$j]->typeMatch($s[$j]) && $c[$j] == $s[$j]) {

$score[$j] = 1;

$totalscore = $totalscore + 1;

}

if ($score[$j]==1) {

$answerHash->setMessage($j1,"This answer is correct");

} else {

$answerHash->setMessage($j1,"This answer is not correct");

}

}

return ($totalscore > 0);

}

);

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

# Main text

Context()->texStrings;

BEGIN_TEXT

Do ONLY ONE of the following problems, (a), (b), or (c).

$BR

$BR

$BR

(a) Find a solution to

\( \displaystyle \frac{dy}{dx} = xy + $a x + $b y + $ab \).

$BR

$BR

\{ $multians->ans_rule(20) \}

$BR

$BR

$BR

(b) A pomegranate is thrown from ground level straight up into the air at

time \(t=0\) with velocity $ab feet per second. Its height in feet at \(t\)

seconds is \(f(t)=-16 t^2+$ab t\). Find the time it reaches its highest point

$BR

$BR

\(t=\) \{ $multians->ans_rule(20)\}

$BR

$BR

$BR

(c) Find the equation of the solution to

\( \displaystyle \frac{dy}{dx} = x^{$n} y \)

through the point \( (x,y) = (1,$ac) \).

$BR

$BR

\{ $multians->ans_rule(30) \}

END_TEXT

Context()->normalStrings;

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

# Answer evaluation

$showPartialCorrectAnswers = 0;

ANS( $multians->cmp() );

COMMENT("MathObject version. The student will receive full credit if any one of the answers is correct.");

ENDDOCUMENT();

You are currently using guest access (Log in)