DOCUMENT();

loadMacros("PG.pl",
           "PGbasicmacros.pl",
           "PGchoicemacros.pl",
           "PGanswermacros.pl",
           ); 
 




# allow the student to change the seed for this problem.
$newProblemSeed = ( defined( ${$inputs_ref}{'newProblemSeed'} ) )?  ${$inputs_ref}{'newProblemSeed'} : $problemSeed;
$PG_random_generator->srand($newProblemSeed);

$p = random(2,9,1);  # multiplier
$p2 = ( $p % 2 == 0) ? 2*$p : $p;

TEXT(beginproblem());

# The link to the java applet is hard wired to use the java applet
# served from the University of Rochester WeBWorK machine.
# It is possible to set this up so that the java applet is served
# from any machine
# For details use the Feedback button to contact the authors of WeBWorK

BEGIN_TEXT
This problem requires a browser capable of running Java.
$PAR
To see a different version of the problem change
the problem seed and press the 'Submit Answer' button below.$PAR Problem Seed:
\{  M3(
qq! Change the problem seed to change the problem:$problemSeed!,
qq! Change the problem seed to change the problem:
    \begin{rawhtml}
    <INPUT NAME="newProblemSeed" VALUE = "$newProblemSeed" SIZE = "10">
    \end{rawhtml}!,
qq! <INPUT NAME="newProblemSeed" VALUE = "$newProblemSeed" SIZE = "10">!
)
\}
$PAR
This problem illustrates how you can Java applets in a WeBWorK example.
$PAR
This polar coordinate grapher was designed at constructed at Mathematics Department
at The Johns Hopkins University
$PAR
WeBWorK can use existing $BBOLD JavaScript$EBOLD  and $BBOLD Java $EBOLD code to augment its capabilities.
$HR
END_TEXT
TEXT(TEX("The Johns Hopkins University Mathematics Department's polar graph plotting applet goes here",
qq{
<APPLET CODE="PolarApplet/PolarApplet.class" WIDTH="250" HEIGHT="350"
CODEBASE="http://xena.mat.jhu.edu/vander/stable/">
<PARAM NAME="tmin" VALUE="0">
<PARAM NAME="tmax" VALUE="2*pi">
<PARAM NAME="showcartesian" VALUE="no">
<PARAM NAME="showinterval" VALUE="YES">
</APPLET>
}, 

));

BEGIN_TEXT
$PAR
For what value of \( k \) does the graph of \( r = \cos(kt) \) look like a rose with $p2 petals?
$BR
\(k = \) \{ ans_rule(20) \} ;

$PAR
You can view the \{ htmlLink(alias("prob6b.html"),"source", q!TARGET="source"!)\} for this problem.
or consult the \{ htmlLink("${webworkDocsURL}techdescription/pglanguage/index.html","documentation") \}  for  more details on the PG language.

END_TEXT

ANS(num_cmp($p) );
			
ENDDOCUMENT();