## WeBWorK Problems

### Authoring with PGML, popup, and numbers with units

by Justin Heckman -
Number of replies: 2
Hi,

I have been authoring rather lengthy multi step problems for high school physics. I have had a great deal of success with getting questions with units to work but is I try and include a multiple choice type question in the sequence the result for submission suggests that the answer chosen from the pull down menu needs units. I was hoping some one could help me figure this out. Also sorry about the super long code
I am rather new to authoring problems and I have learned from looking at examples of code so. . . . Here is the code for the problem I am working with

# DESCRIPTION
#
# WeBWorK problem written by Justin Heckman
# Council Bluffs Community Schools
# ENDDESCRIPTION

## DBsubject('')
## DBchapter('')
## DBsection('')
## KEYWORDS('')
## TitleText1('')
## EditionText1('')
## AuthorText1('')
## Section1('')
## Problem1('')
## Author('Justin Heckman')
## Institution('Council Bluffs Community School District')

DOCUMENT();

"PGstandard.pl",
"PGcourse.pl",
"MathObjects.pl",
"PGauxiliaryFunctions.pl",
"PGchoicemacros.pl",
"scaffold.pl",
"parserNumberWithUnits.pl",
"parserFormulaWithUnits.pl",
"PGML.pl",
"parserPopUp.pl"
);

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

Context("Numeric");

$xh= random(10, 30, 2);$vb= random(5, 15 , 1);
$vobu= NumberWithUnits("0 m/s");$g=(9.81);
$ag= NumberWithUnits("9.81 m/s^2");$xhu= NumberWithUnits("$xh m");$t= (sqrt(2*$xh/$g));
$tu= NumberWithUnits("$t s");
$xb= ($vb*$t);$xbu= NumberWithUnits("$xb m");$xhgg= random(150, 200, 2);
$vC= random(20, 30, 1);$tbgg= (sqrt(2*$xhgg/$g));
$xC= ($vC*$tbgg);$ns= ($xC/4);$nsu= NumberWithUnits("$ns m");$popup = PopUp(
["?","a","b","c"],
"c",);

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

TEXT(beginproblem());

###################################################
BEGIN_PGML

The subject of the 16 bit game Water Balloon Drop was to drop water
balloons from the top of buildings on unsuspecting bystanders. While the
game was rather lame a lacked dimension it does make for a good physics
problem. By examining the height of the characters in the game in comparison
to the height that the balloons were dropped,it can be determined that the
balloons are being dropped from a height of [$xh] m . Considering that cyclists are worth more points and that they travel at a rate of [$vb] m/s on average
we can use the following to determine how much ahead of a cyclist a balloon
must be dropped to strike a cyclist.

a.) To find the answer to the posed question we will need to determine the the time it take for
the balloon to fall to the ground. To do so we will need to fill out a [:vvaxt:]. By examining the
scenario we can determine the initial velocity of the water balloon, what is it?

[_____]{$vobu}. b.) Since the building is on earth we can also determine the rate at which the balloon speeds up as it fell, a value we refer to as the acceleration due to gravity. What is the acceleration? [_____]{-$ag}.

c.) Finally, we know the distance (x) that the balloon will fall, enter it now!

[_____]{$xhu}. d.) Now that we have 3 pieces of information in our vvaxt we can now determine the remaining pieces. Since we really want to know how far the bike will travel in the time it takes for the balloon to fall what we need to calculate is the time (t) that it takes the balloon to fall to the ground. Which formula will you use to solve for time? A.) [: V_f=v_o+at :] B.) [:v_f^2=v_o^2+2ax:] C.) [:x=v_o*t = (1/2*a*t^2):] [@$popup->menu() @]*

e.) How long will it take the balloon to fall to the ground?

[_____]{$tu}. f.) Considering that the cyclist travels at 6 m/s how far in front of the moving cyclist should the balloon be dropped? [_____]{$xbu}.

g.) The subject of a totally different but similar
game is to drop water balloons from the top of the
golden gate bridge tower on top of passing cars.
The towers have a height of [$xhgg] meters, according to Google, and that cars drive an average of [$vC] m/s
across the bridge. In this game we will assume that
the beginning of each white stripe is 4 m from the
beginning of the next (2m stripe and 2m gap). If this
is game how many white stripes away from the edge
of the beam should a car be when the balloon is released in order to strike a car traveling at
average speed?

[_____]{$nsu}. END_PGML install_problem_grader(~~&std_problem_grader);$showPartialCorrectAnswers = 0;

to

[_]{$popup} Once all the answer blanks are using this method for declaring them, I think you may no longer see this issue (which I think is coming from the answer checking order getting mixed up.) In reply to Justin Heckman ### Re: Authoring with PGML, popup, and numbers with units by Danny Glin - Alex is probably right about the checking order getting mixed up. If his solution doesn't work, try putting the answer checker for the popup immediately after that part of the question. i.e.: ... d.) Now that we have 3 pieces of information in our vvaxt we can now determine the remaining pieces. Since we really want to know how far the bike will travel in the time it takes for the balloon to fall what we need to calculate is the time (t) that it takes the balloon to fall to the ground. Which formula will you use to solve for time? A.) [: V_f=v_o+at :] B.) [:v_f^2=v_o^2+2ax:] C.) [:x=v_o*t = (1/2*a*t^2):] [@$popup->menu() @]*

END_PGML

ANS( $popup->cmp() ); BEGIN_PGML e.) How long will it take the balloon to fall to the ground? [_____]{$tu}.
...