Here's an example of a problem that gives 10% extra credit for the second part, which is hidden until the first part is shown.
DOCUMENT(); loadMacros( "PGstandard.pl", "compoundProblem.pl", ); TEXT(beginproblem); $isProfessor = ($studentLogin eq 'dpvc'); # your userID here # # Start a compound problem. See the compoundProblem.pl # file for more details about the parameters you # can supply. # $cp = new compoundProblem( parts => 2, # the total number of parts in this problem weights => [1,.1], # 10% extra credit for second part allowReset => $isProfessor, # professors get Reset button for testing ); $cp->{totalWeight} = 1; # make part 2 extra credit $part = $cp->part; # look up the current part if ($part == 1) { # # Use a named answer rule here so we can include # the value the student typed in the second half. # BEGIN_TEXT Main Answer: \{NAMED_ANS_RULE("a",25)\} END_TEXT NAMED_ANS(a => num_cmp(5)); } if ($part == 2) { BEGIN_TEXT Main Answer: $a $PAR Extra Credit: \{ans_rule(25)\} END_TEXT ANS(num_cmp(10)); } ENDDOCUMENT();See if that does what you want. The going on to the next part is awkward because the grader will not have been run yet when the text of the problem is being generated, and so you don't know whether the student's answer is right at the time the problem is being displayed. You don't know that until the NEXT time through, and so you need to have the extra "go on to the next part" step. I haven't found a way around that.
The key step for making the second part extra credit rather than part of the full credit is the line
$cp->{totalWeight} = 1;which resets it from being 1.1 to being just 1, so when the student gets the second part, the total will be 110% rather than 100%.
It would be possible to adjust the messages at the bottom somewhat, but you really don't have enough control over those to make it perfect.
Davide